Commit df46e1db authored by Etienne Baqué's avatar Etienne Baqué

Removed asset count update

Rollback changes made on asset count.
Fixed release documentation.
parent abdb9ed2
......@@ -55,9 +55,8 @@ class Release < ApplicationRecord
def assets_count(except: [])
links_count = links.count
sources_count = except.include?(:sources) ? 0 : sources.count
count = links_count + sources_count
evidence.present? ? count + 1 : count
links_count + sources_count
end
def sources
......
......@@ -37,7 +37,7 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated
edit_project_release_url(project, release)
end
def evidence_url
def evidence_file_path
return unless release_evidence_available?
evidence_project_release_url(project, tag, format: :json)
......
......@@ -3,6 +3,7 @@
> - [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/issues/41766) in GitLab 11.7.
> - Using this API you can manipulate GitLab's [Release](../../user/project/releases/index.md) entries.
> - For manipulating links as a release asset, see [Release Links API](links.md).
> - Release Evidences were [introduced](https://gitlab.com/gitlab-org/gitlab/issues/26019) in GitLab 12.5.
## List Releases
......@@ -89,7 +90,7 @@ Example response:
"tag_path":"/root/awesome-app/-/tags/v0.11.1",
"evidence_sha":"760d6cdfb0879c3ffedec13af470e0f71cf52c6cde4d",
"assets":{
"count":7,
"count":6,
"sources":[
{
"format":"zip",
......@@ -122,7 +123,7 @@ Example response:
"external":true
}
],
"evidence_url":"https://gitlab.example.com/root/awesome-app/-/releases/v0.2/evidence.json"
"evidence_file_path":"https://gitlab.example.com/root/awesome-app/-/releases/v0.2/evidence.json"
},
},
{
......@@ -158,7 +159,7 @@ Example response:
},
"evidence_sha":"760d6cdfb0879c3ffedec13af470e0f71cf52c6cde4d",
"assets":{
"count":5,
"count":4,
"sources":[
{
"format":"zip",
......@@ -180,7 +181,7 @@ Example response:
"links":[
],
"evidence_url":"https://gitlab.example.com/root/awesome-app/-/releases/v0.1/evidence.json"
"evidence_file_path":"https://gitlab.example.com/root/awesome-app/-/releases/v0.1/evidence.json"
},
}
]
......@@ -393,7 +394,7 @@ Example response:
"tag_path":"/root/awesome-app/-/tags/v0.11.1",
"evidence_sha":"760d6cdfb0879c3ffedec13af470e0f71cf52c6cde4d",
"assets":{
"count":6,
"count":5,
"sources":[
{
"format":"zip",
......@@ -420,7 +421,7 @@ Example response:
"external":true
}
],
"evidence_url":"https://gitlab.example.com/root/awesome-app/-/releases/v0.3/evidence.json"
"evidence_file_path":"https://gitlab.example.com/root/awesome-app/-/releases/v0.3/evidence.json"
},
}
```
......@@ -501,7 +502,7 @@ Example response:
"tag_path":"/root/awesome-app/-/tags/v0.11.1",
"evidence_sha":"760d6cdfb0879c3ffedec13af470e0f71cf52c6cde4d",
"assets":{
"count":5,
"count":4,
"sources":[
{
"format":"zip",
......@@ -523,7 +524,7 @@ Example response:
"links":[
],
"evidence_url":"https://gitlab.example.com/root/awesome-app/-/releases/v0.1/evidence.json"
"evidence_file_path":"https://gitlab.example.com/root/awesome-app/-/releases/v0.1/evidence.json"
},
}
```
......@@ -585,7 +586,7 @@ Example response:
"tag_path":"/root/awesome-app/-/tags/v0.11.1",
"evidence_sha":"760d6cdfb0879c3ffedec13af470e0f71cf52c6cde4d",
"assets":{
"count":5,
"count":4,
"sources":[
{
"format":"zip",
......@@ -607,7 +608,7 @@ Example response:
"links":[
],
"evidence_url":"https://gitlab.example.com/root/awesome-app/-/releases/v0.1/evidence.json"
"evidence_file_path":"https://gitlab.example.com/root/awesome-app/-/releases/v0.1/evidence.json"
},
}
```
......
......@@ -1325,7 +1325,7 @@ module API
expose :links, using: Entities::Releases::Link do |release, options|
release.links.sorted
end
expose :evidence_url, expose_nil: false
expose :evidence_file_path, expose_nil: false
end
expose :_links do
expose :merge_requests_url, expose_nil: false
......
......@@ -72,13 +72,6 @@ RSpec.describe Release do
expect(assets_count).to eq(1)
end
end
context 'when evidence is available' do
it 'counts this evidence', :sidekiq_inline do
evidence_count = release.assets_count - release.sources.count - release.links.count
expect(evidence_count).to eq(1)
end
end
end
describe '#sources' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment