summaryrefslogtreecommitdiff
path: root/app/serializers/commit_entity.rb
diff options
context:
space:
mode:
authorPaul Slaughter <pslaughter@gitlab.com>2018-10-03 01:44:18 -0500
committerPaul Slaughter <pslaughter@gitlab.com>2018-10-03 13:18:20 -0500
commit5a286eb7a3a0c395d35c722ce6a067aca47473f2 (patch)
tree1eb9364a353cf0dca945e073f7b7f74b246307f2 /app/serializers/commit_entity.rb
parentc375171bfd4b25d8cf4d7a95e2c65c655c7d647c (diff)
downloadgitlab-ce-5a286eb7a3a0c395d35c722ce6a067aca47473f2.tar.gz
Add signature badge to diffs/commit_item
**Notes:** - Also exposes commit.signature_html in diffs.json
Diffstat (limited to 'app/serializers/commit_entity.rb')
-rw-r--r--app/serializers/commit_entity.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/serializers/commit_entity.rb b/app/serializers/commit_entity.rb
index 396e95a03c8..90406701bbb 100644
--- a/app/serializers/commit_entity.rb
+++ b/app/serializers/commit_entity.rb
@@ -25,4 +25,14 @@ class CommitEntity < API::Entities::Commit
expose :title_html, if: { type: :full } do |commit|
markdown_field(commit, :title)
end
+
+ expose :signature_html, if: { type: :full } do |commit|
+ render('projects/commit/_signature', signature: commit.signature) if commit.has_signature?
+ end
+
+ def render(*args)
+ return unless request.respond_to?(:render) && request.render.respond_to?(:call)
+
+ request.render.call(*args)
+ end
end