summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-07-15 17:32:49 -0500
committerDouwe Maan <douwe@selenight.nl>2016-07-15 17:32:49 -0500
commitc5555c8a84f10dd4a3f3f213bcf8b088e2a79718 (patch)
tree5014051cba38fa6e5f5b6926136a8b587f2995a5
parentfbd75c35fd3fd43f6680b925959ac9498e9528a5 (diff)
downloadgitlab-ce-c5555c8a84f10dd4a3f3f213bcf8b088e2a79718.tar.gz
Don't fail when a LegacyDiffNote didn't store the right diff
-rw-r--r--app/models/legacy_diff_note.rb4
-rw-r--r--app/views/notify/note_merge_request_email.html.haml2
2 files changed, 3 insertions, 3 deletions
diff --git a/app/models/legacy_diff_note.rb b/app/models/legacy_diff_note.rb
index 790dfd4d480..04a651d50ab 100644
--- a/app/models/legacy_diff_note.rb
+++ b/app/models/legacy_diff_note.rb
@@ -38,7 +38,7 @@ class LegacyDiffNote < Note
end
def diff_line
- @diff_line ||= diff_file.line_for_line_code(self.line_code)
+ @diff_line ||= diff_file.line_for_line_code(self.line_code) if diff_file
end
def for_line?(line)
@@ -55,7 +55,7 @@ class LegacyDiffNote < Note
def active?
return @active if defined?(@active)
return true if for_commit?
- return true unless self.diff
+ return true unless diff_line
return false unless noteable
noteable_diff = find_noteable_diff
diff --git a/app/views/notify/note_merge_request_email.html.haml b/app/views/notify/note_merge_request_email.html.haml
index 35c4b862bb7..ea7e3d199fd 100644
--- a/app/views/notify/note_merge_request_email.html.haml
+++ b/app/views/notify/note_merge_request_email.html.haml
@@ -1,4 +1,4 @@
-- if @note.diff_note?
+- if @note.diff_note? && @note.diff_file
%p.details
New comment on diff for
= link_to @note.diff_file.file_path, @target_url