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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-10-18 12:54:44 +0300
committerYorick Peterse <yorickpeterse@gmail.com>2016-10-18 12:54:44 +0300
commitb1be32203012e5cbc57146e32d82a641d0211dcd (patch)
tree3e0eb90582c6edf6c83082ec4c1a89bbd8dc1a5c
parent275bcfb6b2b1a417fbedca8b175ed812d12ba70a (diff)
parent6a16697ad29bc2136411faf2431baa94f2a599e0 (diff)
Merge branch 'faster_toggle_award_url_helper_method' into 'master'
Execute specific named route method from toggle_award_url helper method See merge request !6848
-rw-r--r--CHANGELOG.md1
-rw-r--r--app/helpers/award_emoji_helper.rb9
2 files changed, 7 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b2501bd265e..b4c2555d0b2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -54,6 +54,7 @@ Please view this file on the master branch, on stable branches it's out of date.
- Add Issue Board API support (andrebsguedes)
- Allow the Koding integration to be configured through the API
- Add new issue button to each list on Issues Board
+ - Execute specific named route method from toggle_award_url helper method
- Added soft wrap button to repository file/blob editor
- Update namespace validation to forbid reserved names (.git and .atom) (Will Starms)
- Show the time ago a merge request was deployed to an environment
diff --git a/app/helpers/award_emoji_helper.rb b/app/helpers/award_emoji_helper.rb
index aa134cea31c..493f14f6f9d 100644
--- a/app/helpers/award_emoji_helper.rb
+++ b/app/helpers/award_emoji_helper.rb
@@ -1,9 +1,12 @@
module AwardEmojiHelper
def toggle_award_url(awardable)
- if @project
- url_for([:toggle_award_emoji, @project.namespace.becomes(Namespace), @project, 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 (6.5x)
+ toggle_award_emoji_namespace_project_note_url(namespace_id: @project.namespace_id, project_id: @project.id, id: awardable.id)
else
- url_for([:toggle_award_emoji, awardable])
+ url_for([:toggle_award_emoji, @project.namespace.becomes(Namespace), @project, awardable])
end
end
end