Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-08-17 20:14:44 +0300
committerDouwe Maan <douwe@selenight.nl>2016-08-17 20:16:46 +0300
commit4a13aa9f34ab4114bc485e1ca8fa0db8daa0394b (patch)
tree17554a901009603f52be08914636495b06db2e68 /app/models/legacy_diff_note.rb
parentf3acf9fd248a16665a114bf6cce761e9277c2d5b (diff)
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.rb12
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