Commit 893a68ba authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Cache autocomplete or emojis

parent a42d84ec
......@@ -104,15 +104,8 @@ class ProjectsController < ApplicationController
autocomplete = ::Projects::AutocompleteService.new(@project)
participants = ::Projects::ParticipantsService.new(@project).execute(note_type, note_id)
emojis = Emoji.names.map do |e|
{
name: e,
path: view_context.image_url("emoji/#{e}.png")
}
end
@suggestions = {
emojis: emojis,
emojis: autocomplete_emojis,
issues: autocomplete.issues,
mergerequests: autocomplete.merge_requests,
members: participants
......@@ -189,4 +182,15 @@ class ProjectsController < ApplicationController
:wiki_enabled, :visibility_level, :import_url, :last_activity_at, :namespace_id
)
end
def autocomplete_emojis
Rails.cache.fetch("autocomplete-emoji-#{Emoji::VERSION}") do
Emoji.names.map do |e|
{
name: e,
path: view_context.image_url("emoji/#{e}.png")
}
end
end
end
end
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