2016-09-04 04:51:12 -04:00
|
|
|
module AwardEmojiHelper
|
|
|
|
def toggle_award_url(awardable)
|
2016-10-13 07:01:27 -04:00
|
|
|
return url_for([:toggle_award_emoji, awardable]) unless @project
|
|
|
|
|
|
|
|
if awardable.is_a?(Note)
|
2016-10-19 15:58:12 -04:00
|
|
|
# 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)
|
2016-09-04 04:51:12 -04:00
|
|
|
else
|
2016-10-13 07:01:27 -04:00
|
|
|
url_for([:toggle_award_emoji, @project.namespace.becomes(Namespace), @project, awardable])
|
2016-09-04 04:51:12 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|