summaryrefslogtreecommitdiff
path: root/app/helpers/award_emoji_helper.rb
blob: 167b09e678f39f188a68177387516a3a81250109 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
module AwardEmojiHelper
  def toggle_award_url(awardable)
    return url_for([:toggle_award_emoji, awardable]) unless @project

    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)
      toggle_award_emoji_namespace_project_note_url(@project.namespace, @project, awardable.id)
    else
      url_for([:toggle_award_emoji, @project.namespace.becomes(Namespace), @project, awardable])
    end
  end
end