diff options
Diffstat (limited to 'app/serializers/commit_entity.rb')
-rw-r--r-- | app/serializers/commit_entity.rb | 17 |
1 files changed, 13 insertions, 4 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 |