diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-08-17 12:14:44 -0500 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-08-17 12:16:46 -0500 |
commit | 4a13aa9f34ab4114bc485e1ca8fa0db8daa0394b (patch) | |
tree | 17554a901009603f52be08914636495b06db2e68 /app/models/legacy_diff_note.rb | |
parent | f3acf9fd248a16665a114bf6cce761e9277c2d5b (diff) | |
download | gitlab-ce-4a13aa9f34ab4114bc485e1ca8fa0db8daa0394b.tar.gz |
Store discussion_id on Note for faster discussion lookup.
Diffstat (limited to 'app/models/legacy_diff_note.rb')
-rw-r--r-- | app/models/legacy_diff_note.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/models/legacy_diff_note.rb b/app/models/legacy_diff_note.rb index f15553d706e..8e26cbe9835 100644 --- a/app/models/legacy_diff_note.rb +++ b/app/models/legacy_diff_note.rb @@ -8,8 +8,8 @@ class LegacyDiffNote < Note before_create :set_diff class << self - def build_discussion_id(noteable_type, noteable_id, line_code, active = true) - [super(noteable_type, noteable_id), line_code, active].join("-") + def build_discussion_id(noteable_type, noteable_id, line_code) + [super(noteable_type, noteable_id), line_code].join("-") end end @@ -21,10 +21,6 @@ class LegacyDiffNote < Note { line_code: line_code } end - def discussion_id - @discussion_id ||= Digest::SHA1.hexdigest(self.class.build_discussion_id(noteable_type, noteable_id || commit_id, line_code)) - end - def project_repository if RequestStore.active? RequestStore.fetch("project:#{project_id}:repository") { self.project.repository } @@ -119,4 +115,8 @@ class LegacyDiffNote < Note diffs = noteable.raw_diffs(Commit.max_diff_options) diffs.find { |d| d.new_path == self.diff.new_path } end + + def build_discussion_id + self.class.build_discussion_id(noteable_type, noteable_id || commit_id, line_code) + end end |