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
......