summaryrefslogtreecommitdiff
path: root/app/views/search
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 /app/views/search
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 'app/views/search')
-rw-r--r--app/views/search/results/_note.html.haml18
1 files changed, 7 insertions, 11 deletions
diff --git a/app/views/search/results/_note.html.haml b/app/views/search/results/_note.html.haml
index 5fcba2b7e93..9544e3d3e17 100644
--- a/app/views/search/results/_note.html.haml
+++ b/app/views/search/results/_note.html.haml
@@ -1,24 +1,20 @@
- project = note.project
+- note_url = Gitlab::UrlBuilder.new(:note).build(note.id)
+- noteable_identifier = note.noteable.try(:iid) || note.noteable.id
.search-result-row
%h5.note-search-caption.str-truncated
%i.fa.fa-comment
= link_to_member(project, note.author, avatar: false)
commented on
+ = link_to project.name_with_namespace, project
+ &middot;
- if note.for_commit?
- = link_to project do
- = project.name_with_namespace
- &middot;
- = link_to namespace_project_commit_path(project.namespace, project, note.commit_id, anchor: dom_id(note)) do
- Commit #{truncate_sha(note.commit_id)}
+ = link_to "Commit #{truncate_sha(note.commit_id)}", note_url
- else
- = link_to project do
- = project.name_with_namespace
- &middot;
- %span #{note.noteable_type.titleize} ##{note.noteable.iid}
+ %span #{note.noteable_type.titleize} ##{noteable_identifier}
&middot;
- = link_to [project.namespace.becomes(Namespace), project, note.noteable, anchor: dom_id(note)] do
- = note.noteable.title
+ = link_to note.noteable.title, note_url
.note-search-result
.term