summaryrefslogtreecommitdiff
path: root/app/serializers/commit_entity.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers/commit_entity.rb')
-rw-r--r--app/serializers/commit_entity.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/serializers/commit_entity.rb b/app/serializers/commit_entity.rb
new file mode 100644
index 00000000000..31763955f97
--- /dev/null
+++ b/app/serializers/commit_entity.rb
@@ -0,0 +1,23 @@
+class CommitEntity < API::Entities::RepoCommit
+ include RequestAwareEntity
+
+ expose :author, using: UserEntity
+
+ expose :author_gravatar_url do |commit|
+ GravatarService.new.execute(commit.author_email)
+ end
+
+ expose :commit_url do |commit|
+ namespace_project_commit_url(
+ request.project.namespace,
+ request.project,
+ commit)
+ end
+
+ expose :commit_path do |commit|
+ namespace_project_commit_path(
+ request.project.namespace,
+ request.project,
+ commit)
+ end
+end