Welcome to mirror list, hosted at ThFree Co, Russian Federation.

award_emoji_helper.rb « helpers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 196415bb3639d041033d2270f54407bb0ff0c048 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

module AwardEmojiHelper
  def toggle_award_url(awardable)
    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)
      if awardable.for_personal_snippet?
        gitlab_toggle_award_emoji_snippet_note_path(awardable.noteable, awardable)
      else
        toggle_award_emoji_project_note_path(@project, awardable.id)
      end
    else
      url_for([:toggle_award_emoji, @project, awardable])
    end
  end
end

AwardEmojiHelper.prepend_mod_with('AwardEmojiHelper')