summaryrefslogtreecommitdiff
path: root/app/models/note.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-06 23:15:54 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-06 23:15:54 +0300
commit2aef3b00cf2ee06dc4128a1a54483cccc1fd48f9 (patch)
treed29ced54655bab917d504396e2c68d52710efd29 /app/models/note.rb
parentbc6a17a6828f2695a7ad0f64671ac1b6845c111d (diff)
downloadgitlab-ce-2aef3b00cf2ee06dc4128a1a54483cccc1fd48f9.tar.gz
Refactor link to new diff note rendering
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index cee10ec90d2..278c957af0e 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -122,11 +122,15 @@ class Note < ActiveRecord::Base
discussions
end
- end
- # Determine whether or not a cross-reference note already exists.
- def self.cross_reference_exists?(noteable, mentioner)
- where(noteable_id: noteable.id, system: true, note: "_mentioned in #{mentioner.gfm_reference}_").any?
+ def build_discussion_id(type, id, line_code)
+ [:discussion, type.try(:underscore), id, line_code].join("-").to_sym
+ end
+
+ # Determine whether or not a cross-reference note already exists.
+ def cross_reference_exists?(noteable, mentioner)
+ where(noteable_id: noteable.id, system: true, note: "_mentioned in #{mentioner.gfm_reference}_").any?
+ end
end
def commit_author
@@ -194,7 +198,7 @@ class Note < ActiveRecord::Base
end
def discussion_id
- @discussion_id ||= [:discussion, noteable_type.try(:underscore), noteable_id || commit_id, line_code].join("-").to_sym
+ @discussion_id ||= Note.build_discussion_id(noteable_type, noteable_id || commit_id, line_code)
end
# Returns true if this is a downvote note,