summaryrefslogtreecommitdiff
path: root/lib/gitlab
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-03-31 09:21:20 +0200
committerRémy Coutable <remy@rymai.me>2016-03-31 09:40:57 +0200
commite60f034126712b7e5a3b3ff9c5e92359aaf96e10 (patch)
tree5be2d71274cfc11e60e85222082c51d0f2cc2fb6 /lib/gitlab
parent091b8a6ede2515bb555ec8662b9d933d70bda3e9 (diff)
downloadgitlab-ce-e60f034126712b7e5a3b3ff9c5e92359aaf96e10.tar.gz
Fix view of notes in search results when noteable is a snippetsnippets-with-comments-cause-a-500-when-they-show-up-in-search-results-14764
Also, streamline the view. Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/url_builder.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/gitlab/url_builder.rb b/lib/gitlab/url_builder.rb
index 7486510a4af..e157bb96f2a 100644
--- a/lib/gitlab/url_builder.rb
+++ b/lib/gitlab/url_builder.rb
@@ -2,6 +2,7 @@ module Gitlab
class UrlBuilder
include Gitlab::Application.routes.url_helpers
include GitlabRoutingHelper
+ include ActionView::RecordIdentifier
def initialize(type)
@type = type
@@ -37,19 +38,16 @@ module Gitlab
namespace_project_commit_url(namespace_id: note.project.namespace,
id: note.commit_id,
project_id: note.project,
- anchor: "note_#{note.id}")
+ anchor: dom_id(note))
elsif note.for_issue?
issue = Issue.find(note.noteable_id)
- issue_url(issue,
- anchor: "note_#{note.id}")
+ issue_url(issue, anchor: dom_id(note))
elsif note.for_merge_request?
merge_request = MergeRequest.find(note.noteable_id)
- merge_request_url(merge_request,
- anchor: "note_#{note.id}")
+ merge_request_url(merge_request, anchor: dom_id(note))
elsif note.for_snippet?
snippet = Snippet.find(note.noteable_id)
- project_snippet_url(snippet,
- anchor: "note_#{note.id}")
+ project_snippet_url(snippet, anchor: dom_id(note))
end
end
end