Commit 73c9d80b authored by Grzegorz Bizon's avatar Grzegorz Bizon

Record user that erased a build through API

parent fb62196f
......@@ -138,7 +138,7 @@ module API
return not_found!(build) unless build
return forbidden!('Build is not erasable!') unless build.erasable?
build.erase
build.erase(erased_by: current_user)
present build, with: Entities::Build,
user_can_download_artifacts: can?(current_user, :download_build_artifacts, user_project)
end
......
......@@ -184,6 +184,11 @@ describe API::API, api: true do
expect(build.artifacts_file.exists?).to be_falsy
expect(build.artifacts_metadata.exists?).to be_falsy
end
it 'should update build' do
expect(build.reload.erased_at).to be_truthy
expect(build.reload.erased_by).to eq user
end
end
context 'build is not erasable' 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