debian-mirror-gitlab/app/services/releases/destroy_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
524 B
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
module Releases
2021-01-03 14:25:43 +05:30
class DestroyService < Releases::BaseService
2019-02-15 15:39:39 +05:30
def execute
2022-11-25 23:54:43 +05:30
return error(_('Release does not exist'), 404) unless release
return error(_('Access Denied'), 403) unless allowed?
2019-02-15 15:39:39 +05:30
if release.destroy
success(tag: existing_tag, release: release)
else
error(release.errors.messages || '400 Bad request', 400)
end
end
private
def allowed?
Ability.allowed?(current_user, :destroy_release, release)
end
end
end