debian-mirror-gitlab/app/helpers/award_emoji_helper.rb

13 lines
533 B
Ruby
Raw Normal View History

2016-09-29 09:46:39 +05:30
module AwardEmojiHelper
def toggle_award_url(awardable)
2016-11-03 12:29:30 +05:30
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 (6.5x)
toggle_award_emoji_namespace_project_note_url(namespace_id: @project.namespace, project_id: @project, id: awardable.id)
2016-09-29 09:46:39 +05:30
else
2016-11-03 12:29:30 +05:30
url_for([:toggle_award_emoji, @project.namespace.becomes(Namespace), @project, awardable])
2016-09-29 09:46:39 +05:30
end
end
end