diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-25 10:14:35 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-25 10:14:35 +0300 |
commit | 907548a0fbf3c048536c2012bdbdbd10b604c067 (patch) | |
tree | ae2f99ab9acbd1ecaabf623f30d1af3732c607dd | |
parent | f91f230cec3d4768a752b93f35fa45fb8c85d10a (diff) | |
download | gitlab-ce-907548a0fbf3c048536c2012bdbdbd10b604c067.tar.gz |
dont render discussion diff unless note is for diff
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r-- | app/controllers/projects/notes_controller.rb | 2 | ||||
-rw-r--r-- | app/models/note.rb | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb index fca4c2f652d..66cc1a3dec7 100644 --- a/app/controllers/projects/notes_controller.rb +++ b/app/controllers/projects/notes_controller.rb @@ -86,6 +86,8 @@ class Projects::NotesController < Projects::ApplicationController end def note_to_discussion_with_diff_html(note) + return unless note.for_diff_line? + render_to_string( "projects/notes/_discussion", layout: false, diff --git a/app/models/note.rb b/app/models/note.rb index 590fd338fd9..94d45aa43db 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -183,6 +183,8 @@ class Note < ActiveRecord::Base # If exists - its active discussion # If not - its outdated diff def active? + return true unless self.diff + noteable.diffs.each do |mr_diff| next unless mr_diff.new_path == self.diff.new_path |