Commit 317c9281 authored by Nihad Abbasov's avatar Nihad Abbasov

improve emoji checking performance

parent 9e4f3147
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
#
# Returns boolean
def valid_emoji?(emoji)
File.exists?(Rails.root.join('app', 'assets', 'images', 'emoji', "#{emoji}.png"))
Emoji::NAMES.include? emoji
end
# 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