Commit 35ce7aae authored by Douwe Maan's avatar Douwe Maan

Use sha1 of discussion ID.

parent aa267678
...@@ -57,7 +57,7 @@ module NotesHelper ...@@ -57,7 +57,7 @@ module NotesHelper
data.merge!( data.merge!(
note_type: LegacyDiffNote.name, note_type: LegacyDiffNote.name,
discussion_id: discussion_id discussion_id: Digest::SHA1.hexdigest(discussion_id)
) )
else else
discussion_id = DiffNote.build_discussion_id( discussion_id = DiffNote.build_discussion_id(
...@@ -69,7 +69,7 @@ module NotesHelper ...@@ -69,7 +69,7 @@ module NotesHelper
data.merge!( data.merge!(
position: position.to_json, position: position.to_json,
note_type: DiffNote.name, note_type: DiffNote.name,
discussion_id: discussion_id discussion_id: Digest::SHA1.hexdigest(discussion_id)
) )
end end
......
...@@ -34,11 +34,11 @@ class DiffNote < Note ...@@ -34,11 +34,11 @@ class DiffNote < Note
end end
def discussion_id def discussion_id
@discussion_id ||= self.class.build_discussion_id(noteable_type, noteable_id || commit_id, position) @discussion_id ||= Digest::SHA1.hexdigest(self.class.build_discussion_id(noteable_type, noteable_id || commit_id, position))
end end
def original_discussion_id def original_discussion_id
@original_discussion_id ||= self.class.build_discussion_id(noteable_type, noteable_id || commit_id, original_position) @original_discussion_id ||= Digest::SHA1.hexdigest(self.class.build_discussion_id(noteable_type, noteable_id || commit_id, original_position))
end end
def position=(new_position) def position=(new_position)
......
...@@ -22,7 +22,7 @@ class LegacyDiffNote < Note ...@@ -22,7 +22,7 @@ class LegacyDiffNote < Note
end end
def discussion_id def discussion_id
@discussion_id ||= self.class.build_discussion_id(noteable_type, noteable_id || commit_id, line_code) @discussion_id ||= Digest::SHA1.hexdigest(self.class.build_discussion_id(noteable_type, noteable_id || commit_id, line_code))
end end
def diff_file_hash def diff_file_hash
......
...@@ -145,9 +145,9 @@ class Note < ActiveRecord::Base ...@@ -145,9 +145,9 @@ class Note < ActiveRecord::Base
def discussion_id def discussion_id
@discussion_id ||= @discussion_id ||=
if for_merge_request? if for_merge_request?
[:discussion, :note, id].join("-") Digest::SHA1.hexdigest([:discussion, :note, id].join("-"))
else else
self.class.build_discussion_id(noteable_type, noteable_id || commit_id) Digest::SHA1.hexdigest(self.class.build_discussion_id(noteable_type, noteable_id || commit_id))
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment