diff options
author | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2015-02-21 02:06:39 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2015-02-21 02:06:39 +0000 |
commit | a224a655d812d60fa8be45e36922049b313ecb2f (patch) | |
tree | 62ce86cdaca646f9d51b715da6dd4fb429d8e672 /app/models | |
parent | 5484acd99878a70e95bd5e1f22900b2fd6c612c1 (diff) | |
parent | 0632e85c82eeb76c9b61e497655c9cf2ef5dc262 (diff) | |
download | gitlab-ce-a224a655d812d60fa8be45e36922049b313ecb2f.tar.gz |
Merge branch 'mr-commit-comment-diff-lines' into 'master'
Fix commit comments on first line of diff not rendering in Merge Request Discussion view.
Example can be seen near the bottom on this MR: !1533.
Before:

After: the [note](https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/1533/diffs#note_36449) is actually rendered.
See merge request !1552
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/note.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/app/models/note.rb b/app/models/note.rb index ccd9783e7d4..e6c258ffbe9 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -409,19 +409,19 @@ class Note < ActiveRecord::Base prev_lines = [] diff_lines.each do |line| - if generate_line_code(line) != self.line_code - if line.type == "match" - prev_lines.clear - prev_match_line = line - else - prev_lines.push(line) - prev_lines.shift if prev_lines.length >= max_number_of_lines - end + if line.type == "match" + prev_lines.clear + prev_match_line = line else prev_lines << line - return prev_lines + + break if generate_line_code(line) == self.line_code + + prev_lines.shift if prev_lines.length >= max_number_of_lines end end + + prev_lines end def diff_lines |