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

Use sha1 of discussion ID.

parent aa267678
......@@ -57,7 +57,7 @@ module NotesHelper
data.merge!(
note_type: LegacyDiffNote.name,
discussion_id: discussion_id
discussion_id: Digest::SHA1.hexdigest(discussion_id)
)
else
discussion_id = DiffNote.build_discussion_id(
......@@ -69,7 +69,7 @@ module NotesHelper
data.merge!(
position: position.to_json,
note_type: DiffNote.name,
discussion_id: discussion_id
discussion_id: Digest::SHA1.hexdigest(discussion_id)
)
end
......
......@@ -34,11 +34,11 @@ class DiffNote < Note
end
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
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
def position=(new_position)
......
......@@ -22,7 +22,7 @@ class LegacyDiffNote < Note
end
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
def diff_file_hash
......
......@@ -145,9 +145,9 @@ class Note < ActiveRecord::Base
def discussion_id
@discussion_id ||=
if for_merge_request?
[:discussion, :note, id].join("-")
Digest::SHA1.hexdigest([:discussion, :note, id].join("-"))
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
......
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