diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-11-18 22:31:26 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-11-18 22:31:26 +0100 |
commit | b1f5af40598528fbc1326946376a595d41793537 (patch) | |
tree | fc85fbac4690272de2e6bf5520ba0067dad6a22a | |
parent | 43898f8efbe4981ad2ca67e7804db2c73fe2f3e2 (diff) | |
download | gitlab-ce-b1f5af40598528fbc1326946376a595d41793537.tar.gz |
Bring back the `commit_url` as it's used by CycleAnalytics
-rw-r--r-- | app/serializers/commit_entity.rb | 7 | ||||
-rw-r--r-- | spec/serializers/commit_entity_spec.rb | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/app/serializers/commit_entity.rb b/app/serializers/commit_entity.rb index bc92a1c8545..acc20f6dc52 100644 --- a/app/serializers/commit_entity.rb +++ b/app/serializers/commit_entity.rb @@ -3,6 +3,13 @@ class CommitEntity < API::Entities::RepoCommit expose :author, using: UserEntity + 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, diff --git a/spec/serializers/commit_entity_spec.rb b/spec/serializers/commit_entity_spec.rb index a44a23ef619..15f11ac3df9 100644 --- a/spec/serializers/commit_entity_spec.rb +++ b/spec/serializers/commit_entity_spec.rb @@ -35,6 +35,10 @@ describe CommitEntity do expect(subject).to include(:commit_path) end + it 'contains URL to commit' do + expect(subject).to include(:commit_url) + end + it 'needs to receive project in the request' do expect(request).to receive(:project) .and_return(project) |