Skip to content
Snippets Groups Projects
Commit 317c9281 authored by Nihad Abbasov's avatar Nihad Abbasov
Browse files

improve emoji checking performance

parent 9e4f3147
No related branches found
No related tags found
1 merge request!1632performance and security fixes
Showing
with 5 additions and 1 deletion
module Emoji
path = "#{Rails.root}/vendor/assets/images/emoji"
NAMES = Dir["#{path}/*.png"].sort.map {|f| File.basename(f, '.png')}
end
Loading
Loading
@@ -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
Loading
Loading
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment