Commit a2d06cbf authored by Robert Speicher's avatar Robert Speicher Committed by Rémy Coutable

Merge branch 'fix-mr-comment-commit-pruned' into 'master'

Gracefully handle notes on deleted commits in merge requests

Closes #3250

See merge request !3402
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 5e645889
...@@ -21,6 +21,7 @@ v 8.6.2 ...@@ -21,6 +21,7 @@ v 8.6.2
- Fix background when editing a highlighted note. !3423 - Fix background when editing a highlighted note. !3423
- Remove tabstop from the WIP toggle links. !3426 - Remove tabstop from the WIP toggle links. !3426
- Ensure private project snippets are not viewable by unauthorized people. - Ensure private project snippets are not viewable by unauthorized people.
- Gracefully handle notes on deleted commits in merge requests (Stan Hu). !3402
v 8.6.1 v 8.6.1
- Add option to reload the schema before restoring a database backup. !2807 - Add option to reload the schema before restoring a database backup. !2807
......
...@@ -5,9 +5,11 @@ module NotesHelper ...@@ -5,9 +5,11 @@ module NotesHelper
end end
def note_target_fields(note) def note_target_fields(note)
if note.noteable
hidden_field_tag(:target_type, note.noteable.class.name.underscore) + hidden_field_tag(:target_type, note.noteable.class.name.underscore) +
hidden_field_tag(:target_id, note.noteable.id) hidden_field_tag(:target_id, note.noteable.id)
end end
end
def note_editable?(note) def note_editable?(note)
note.editable? && can?(current_user, :admin_note, note) note.editable? && can?(current_user, :admin_note, note)
......
- note = discussion_notes.first - note = discussion_notes.first
- commit = note.noteable
- commit_description = commit ? 'commit' : 'a deleted commit'
.discussion.js-toggle-container{ class: note.discussion_id } .discussion.js-toggle-container{ class: note.discussion_id }
.discussion-header .discussion-header
.discussion-actions .discussion-actions
...@@ -7,8 +9,9 @@ ...@@ -7,8 +9,9 @@
Show/hide discussion Show/hide discussion
%div %div
= link_to_member(@project, note.author, avatar: false) = link_to_member(@project, note.author, avatar: false)
started a discussion on commit %p started a discussion on #{commit_description}
= link_to(note.noteable.short_id, namespace_project_commit_path(note.project.namespace, note.project, note.noteable), class: 'monospace') - if commit
= link_to(commit.short_id, namespace_project_commit_path(note.project.namespace, note.project, note.noteable), class: 'monospace')
.last-update.hide.js-toggle-content .last-update.hide.js-toggle-content
- last_note = discussion_notes.last - last_note = discussion_notes.last
last updated by last updated by
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment