Commit c0073254 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #1712 from riyad/use-gem-for-emoji

Use gem for Emoji
parents 61e5fb6f ce910147
...@@ -94,6 +94,7 @@ gem 'settingslogic' ...@@ -94,6 +94,7 @@ gem 'settingslogic'
# Misc # Misc
gem "foreman" gem "foreman"
gem 'gemoji', require: 'emoji/railtie'
gem "git" gem "git"
group :assets do group :assets do
......
...@@ -140,6 +140,7 @@ GEM ...@@ -140,6 +140,7 @@ GEM
sass-rails (>= 3.1.1) sass-rails (>= 3.1.1)
foreman (0.47.0) foreman (0.47.0)
thor (>= 0.13.6) thor (>= 0.13.6)
gemoji (1.1.1)
gherkin-ruby (0.2.1) gherkin-ruby (0.2.1)
git (1.2.5) git (1.2.5)
github-linguist (2.3.4) github-linguist (2.3.4)
...@@ -422,6 +423,7 @@ DEPENDENCIES ...@@ -422,6 +423,7 @@ DEPENDENCIES
ffaker ffaker
font-awesome-sass-rails (~> 2.0.0) font-awesome-sass-rails (~> 2.0.0)
foreman foreman
gemoji
git git
github-linguist (~> 2.3.4) github-linguist (~> 2.3.4)
github-markup (~> 0.7.4) github-markup (~> 0.7.4)
......
...@@ -115,7 +115,7 @@ module ApplicationHelper ...@@ -115,7 +115,7 @@ module ApplicationHelper
def emoji_autocomplete_source def emoji_autocomplete_source
# should be an array of strings # should be an array of strings
# so to_s can be called, because it is sufficient and to_json is too slow # so to_s can be called, because it is sufficient and to_json is too slow
Emoji::NAMES.to_s Emoji.names.to_s
end end
def ldap_enable? def ldap_enable?
......
module Emoji
path = "#{Rails.root}/vendor/assets/images/emoji"
NAMES = Dir["#{path}/*.png"].sort.map {|f| File.basename(f, '.png')}
end
...@@ -128,7 +128,7 @@ module Gitlab ...@@ -128,7 +128,7 @@ module Gitlab
# #
# Returns boolean # Returns boolean
def valid_emoji?(emoji) def valid_emoji?(emoji)
Emoji::NAMES.include? emoji Emoji.names.include? emoji
end end
# Private: Dispatches to a dedicated processing method based on reference # Private: Dispatches to a dedicated processing method based on reference
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment