summaryrefslogtreecommitdiff
path: root/app/serializers/commit_entity.rb
blob: 31763955f978d606c1c90ef2d9913407fb519d4a (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_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