summaryrefslogtreecommitdiff
path: root/app/models/commit.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-09-06 17:14:09 +0000
committerDouwe Maan <douwe@gitlab.com>2017-09-06 17:14:09 +0000
commit1c55b5717556f77191409f0f35d25abe6a640af0 (patch)
tree38c0abf8a996bc39981d5c883cb66d0cd3c538fe /app/models/commit.rb
parent92823171d08bd0516d49e0c86a5e7496bdebe382 (diff)
parent6d8e102c740b75ac9e1d168a84f532f6d9ebaa65 (diff)
downloadgitlab-ce-1c55b5717556f77191409f0f35d25abe6a640af0.tar.gz
Merge branch '34509-improves-markdown-rendering-performance-for-commits-list' into 'master'
Resolve "Projects::CommitsController#show is slow partially due to SQL queries" Closes #34509 See merge request !13762
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r--app/models/commit.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index ba3845df867..2ae8890c1b3 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -16,6 +16,8 @@ class Commit
participant :notes_with_associations
attr_accessor :project, :author
+ attr_accessor :redacted_description_html
+ attr_accessor :redacted_title_html
DIFF_SAFE_LINES = Gitlab::Git::DiffCollection::DEFAULT_LIMITS[:max_lines]
@@ -26,6 +28,13 @@ class Commit
# The SHA can be between 7 and 40 hex characters.
COMMIT_SHA_PATTERN = '\h{7,40}'.freeze
+ def banzai_render_context(field)
+ context = { pipeline: :single_line, project: self.project }
+ context[:author] = self.author if self.author
+
+ context
+ end
+
class << self
def decorate(commits, project)
commits.map do |commit|