gitlab-org--gitlab-foss/app/helpers/award_emoji_helper.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
693 B
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
module AwardEmojiHelper
def toggle_award_url(awardable)
2017-04-27 10:41:26 +00:00
return url_for([:toggle_award_emoji, awardable]) unless @project || awardable.is_a?(Note)
if awardable.is_a?(Note)
# We render a list of notes very frequently and calling the specific method is a lot faster than the generic one (4.5x)
2017-04-27 10:41:26 +00:00
if awardable.for_personal_snippet?
gitlab_toggle_award_emoji_snippet_note_path(awardable.noteable, awardable)
2017-04-27 10:41:26 +00:00
else
toggle_award_emoji_project_note_path(@project, awardable.id)
2017-04-27 10:41:26 +00:00
end
else
url_for([:toggle_award_emoji, @project, awardable])
end
end
end
AwardEmojiHelper.prepend_mod_with('AwardEmojiHelper')