diff options
author | Jeroen Jacobs <git@jeroenj.be> | 2014-06-27 16:48:30 +0200 |
---|---|---|
committer | Jeroen Jacobs <git@jeroenj.be> | 2014-09-26 10:58:11 +0200 |
commit | 430758653ce7e4d32b40648e6263b79c2709bdad (patch) | |
tree | dc62ecc9587f532406495ac4a6ac5e53e490088f /app/models/note.rb | |
parent | de5e0e590fa4e75cb9d66398b902a8348a2c42dc (diff) | |
download | gitlab-ce-430758653ce7e4d32b40648e6263b79c2709bdad.tar.gz |
Adds comments to commits in the API
Diffstat (limited to 'app/models/note.rb')
-rw-r--r-- | app/models/note.rb | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/app/models/note.rb b/app/models/note.rb index fa5fdea4eb0..d70ebcd8e6d 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -226,7 +226,7 @@ class Note < ActiveRecord::Base end def diff_file_index - line_code.split('_')[0] + line_code.split('_')[0] if line_code end def diff_file_name @@ -242,11 +242,11 @@ class Note < ActiveRecord::Base end def diff_old_line - line_code.split('_')[1].to_i + line_code.split('_')[1].to_i if line_code end def diff_new_line - line_code.split('_')[2].to_i + line_code.split('_')[2].to_i if line_code end def generate_line_code(line) @@ -267,6 +267,20 @@ class Note < ActiveRecord::Base @diff_line end + def diff_line_type + return @diff_line_type if @diff_line_type + + if diff + diff_lines.each do |line| + if generate_line_code(line) == self.line_code + @diff_line_type = line.type + end + end + end + + @diff_line_type + end + def truncated_diff_lines max_number_of_lines = 16 prev_match_line = nil |