diff options
Diffstat (limited to 'app/graphql/mutations/release_asset_links/update.rb')
-rw-r--r-- | app/graphql/mutations/release_asset_links/update.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/graphql/mutations/release_asset_links/update.rb b/app/graphql/mutations/release_asset_links/update.rb index f9368927371..2e9054c290d 100644 --- a/app/graphql/mutations/release_asset_links/update.rb +++ b/app/graphql/mutations/release_asset_links/update.rb @@ -46,11 +46,15 @@ module Mutations def resolve(id:, **link_attrs) link = authorized_find!(id) - unless link.update(link_attrs) - return { link: nil, errors: link.errors.full_messages } - end + result = ::Releases::Links::UpdateService + .new(link.release, current_user, link_attrs) + .execute(link) - { link: link, errors: [] } + if result.success? + { link: result.payload[:link], errors: [] } + else + { link: nil, errors: result.message } + end end def find_object(id) |