summaryrefslogtreecommitdiff
path: root/app/serializers/commit_entity.rb
blob: 49f4db36295c6e615464ce8b7b2e4b400fe9f0f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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_tree_url(
      request.project.namespace,
      request.project,
      id: commit.id)
  end

  expose :commit_path do |commit|
    namespace_project_tree_path(
      request.project.namespace,
      request.project,
      id: commit.id)
  end
end