diff options
author | hhoopes <heidih@gmail.com> | 2016-08-31 10:18:26 -0600 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2016-11-25 15:23:49 +0000 |
commit | a761c59a6bfc4d66649910d01e4c8412bb0b40ec (patch) | |
tree | c2c06dbbc20d140bda5ed2cd6abfa0e2f36805d0 /app/models/discussion.rb | |
parent | f928dba99b0550cefa7534d7fd5bd1ea16609274 (diff) | |
download | gitlab-ce-a761c59a6bfc4d66649910d01e4c8412bb0b40ec.tar.gz |
Add keyword arguments to truncated_diff method
* Added keyword arguments to truncated_diff_lines method to allow for using highlighting or not (html templates vs. text)
* Tweaked templates for consistency and format appropriateness
Diffstat (limited to 'app/models/discussion.rb')
-rw-r--r-- | app/models/discussion.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/models/discussion.rb b/app/models/discussion.rb index 486bfd2c766..9bd37fe6d89 100644 --- a/app/models/discussion.rb +++ b/app/models/discussion.rb @@ -27,7 +27,7 @@ class Discussion delegate :blob, :highlighted_diff_lines, - :text_parsed_diff_lines, + :diff_lines, to: :diff_file, allow_nil: true @@ -164,10 +164,11 @@ class Discussion end # Returns an array of at most 16 highlighted lines above a diff note - def truncated_diff_lines + def truncated_diff_lines(highlight: true) + initial_lines = highlight ? highlighted_diff_lines : diff_lines prev_lines = [] - diff_file.diff_lines.each do |line| + initial_lines.each do |line| if line.meta? prev_lines.clear else |