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:
authorPaul Slaughter <pslaughter@gitlab.com>2018-09-26 11:28:50 +0300
committerPhil Hughes <me@iamphill.com>2018-09-26 11:28:50 +0300
commitf3901842493c58faba71ad0812bf3102790a1b9f (patch)
treef30d0f4c67e80ec8fd591fa43b0b9b59998423c7 /app/serializers
parentc7fcb01b8adf988e2e10e63979507d99bedba163 (diff)
Resolve "Commit details are not displayed when reviewing an MR commit by commit"
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/commit_entity.rb17
-rw-r--r--app/serializers/diffs_entity.rb7
2 files changed, 18 insertions, 6 deletions
diff --git a/app/serializers/commit_entity.rb b/app/serializers/commit_entity.rb
index ce76659fa46..396e95a03c8 100644
--- a/app/serializers/commit_entity.rb
+++ b/app/serializers/commit_entity.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
class CommitEntity < API::Entities::Commit
+ include MarkupHelper
include RequestAwareEntity
expose :author, using: UserEntity
@@ -9,11 +10,19 @@ class CommitEntity < API::Entities::Commit
GravatarService.new.execute(commit.author_email) # rubocop: disable CodeReuse/ServiceClass
end
- expose :commit_url do |commit|
- project_commit_url(request.project, commit)
+ expose :commit_url do |commit, options|
+ project_commit_url(request.project, commit, params: options.fetch(:commit_url_params, {}))
end
- expose :commit_path do |commit|
- project_commit_path(request.project, commit)
+ expose :commit_path do |commit, options|
+ project_commit_path(request.project, commit, params: options.fetch(:commit_url_params, {}))
+ end
+
+ expose :description_html, if: { type: :full } do |commit|
+ markdown_field(commit, :description)
+ end
+
+ expose :title_html, if: { type: :full } do |commit|
+ markdown_field(commit, :title)
end
end
diff --git a/app/serializers/diffs_entity.rb b/app/serializers/diffs_entity.rb
index 878cc5290bd..00dc55fc004 100644
--- a/app/serializers/diffs_entity.rb
+++ b/app/serializers/diffs_entity.rb
@@ -15,8 +15,11 @@ class DiffsEntity < Grape::Entity
merge_request&.target_branch
end
- expose :commit do |diffs|
- options[:commit]
+ expose :commit do |diffs, options|
+ CommitEntity.represent options[:commit], options.merge(
+ type: :full,
+ commit_url_params: { merge_request_iid: merge_request&.iid }
+ )
end
expose :merge_request_diff, using: MergeRequestDiffEntity do |diffs|