Commit b91d6802572eeb152bd86dd68c54ef4151180848

Authored by Riyad Preukschas
1 parent fc1c250d

Fix notes helper

Showing 1 changed file with 4 additions and 7 deletions   Show diff stats
app/helpers/notes_helper.rb
... ... @@ -9,16 +9,13 @@ module NotesHelper
9 9  
10 10 # Helps to distinguish e.g. commit notes in mr notes list
11 11 def note_for_main_target?(note)
12   - !@mixed_targets || @main_target_type == note.noteable_type
  12 + !@mixed_targets || (@main_target_type == note.noteable_type && !note.for_diff_line?)
13 13 end
14 14  
15 15 def link_to_commit_diff_line_note(note)
16   - commit = note.noteable
17   - diff_index, diff_old_line, diff_new_line = note.line_code.split('_')
  16 + if note.for_commit_diff_line?
  17 + link_to "#{note.diff_file_name}:L#{note.diff_new_line}", project_commit_path(@project, note.noteable, anchor: note.line_code)
  18 + end
18 19  
19   - link_file = commit.diffs[diff_index.to_i].new_path
20   - link_line = diff_new_line
21   -
22   - link_to "#{link_file}:L#{link_line}", project_commit_path(@project, commit, anchor: note.line_code)
23 20 end
24 21 end
... ...