switch to use link_to_member to prevent 500 if user is a project owner but does not have membership and leave comment
This commit is contained in:
parent
843ea5bf22
commit
2e9c0e2b47
|
@ -60,7 +60,7 @@
|
||||||
> a {
|
> a {
|
||||||
padding: 8px 20px;
|
padding: 8px 20px;
|
||||||
margin-right: 7px;
|
margin-right: 7px;
|
||||||
line-height: 19px;
|
line-height: 20px;
|
||||||
border-color: #EEE;
|
border-color: #EEE;
|
||||||
color: #888;
|
color: #888;
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
|
|
|
@ -22,7 +22,7 @@ ul.notes {
|
||||||
.note-last-update {
|
.note-last-update {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
.note-author {
|
.author {
|
||||||
color: $style_color;
|
color: $style_color;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|
|
@ -20,16 +20,21 @@ module ProjectsHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_to_member(project, author)
|
def link_to_member(project, author, opts = {})
|
||||||
|
default_opts = { avatar: true }
|
||||||
|
opts = default_opts.merge(opts)
|
||||||
|
|
||||||
return "(deleted)" unless author
|
return "(deleted)" unless author
|
||||||
|
|
||||||
|
author_html = ""
|
||||||
|
|
||||||
# Build avatar image tag
|
# Build avatar image tag
|
||||||
avatar = image_tag(gravatar_icon(author.try(:email)), width: 16, class: "lil_av")
|
author_html << image_tag(gravatar_icon(author.try(:email)), width: 16, class: "lil_av") if opts[:avatar]
|
||||||
|
|
||||||
# Build name span tag
|
# Build name span tag
|
||||||
name = content_tag :span, author.name, class: 'author'
|
author_html << content_tag(:span, sanitize(author.name), class: 'author')
|
||||||
|
|
||||||
author_html = avatar + name
|
author_html = author_html.html_safe
|
||||||
|
|
||||||
tm = project.team_member_by_id(author)
|
tm = project.team_member_by_id(author)
|
||||||
|
|
||||||
|
@ -37,7 +42,7 @@ module ProjectsHelper
|
||||||
link_to author_html, project_team_member_path(project, tm), class: "author_link"
|
link_to author_html, project_team_member_path(project, tm), class: "author_link"
|
||||||
else
|
else
|
||||||
author_html
|
author_html
|
||||||
end
|
end.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def tm_path team_member
|
def tm_path team_member
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
Show discussion
|
Show discussion
|
||||||
= image_tag gravatar_icon(note.author.email), class: "avatar s32"
|
= image_tag gravatar_icon(note.author.email), class: "avatar s32"
|
||||||
%div
|
%div
|
||||||
= link_to note.author_name, project_team_member_path(@project, @project.team_member_by_id(note.author)), class: "note-author"
|
= link_to_member(@project, note.author, avatar: false)
|
||||||
- if note.for_merge_request?
|
- if note.for_merge_request?
|
||||||
- if note.diff
|
- if note.diff
|
||||||
started a discussion on this merge request diff
|
started a discussion on this merge request diff
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
%div
|
%div
|
||||||
- last_note = discussion_notes.last
|
- last_note = discussion_notes.last
|
||||||
last updated by
|
last updated by
|
||||||
= link_to last_note.author_name, project_team_member_path(@project, @project.team_member_by_id(last_note.author)), class: "note-author"
|
= link_to_member(@project, last_note.author, avatar: false)
|
||||||
%span.discussion-last-update
|
%span.discussion-last-update
|
||||||
= time_ago_in_words(last_note.updated_at)
|
= time_ago_in_words(last_note.updated_at)
|
||||||
ago
|
ago
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
= link_to project_note_path(@project, note), title: "Remove comment", method: :delete, confirm: 'Are you sure you want to remove comment?', remote: true, class: "danger js-note-delete" do
|
= link_to project_note_path(@project, note), title: "Remove comment", method: :delete, confirm: 'Are you sure you want to remove comment?', remote: true, class: "danger js-note-delete" do
|
||||||
%i.icon-trash.cred
|
%i.icon-trash.cred
|
||||||
= image_tag gravatar_icon(note.author.email), class: "avatar s32"
|
= image_tag gravatar_icon(note.author.email), class: "avatar s32"
|
||||||
= link_to note.author_name, project_team_member_path(@project, @project.team_member_by_id(note.author)), class: "note-author"
|
= link_to_member(@project, note.author, avatar: false)
|
||||||
%span.note-last-update
|
%span.note-last-update
|
||||||
= time_ago_in_words(note.updated_at)
|
= time_ago_in_words(note.updated_at)
|
||||||
ago
|
ago
|
||||||
|
|
Loading…
Reference in a new issue