Skip to content

Resolve "DRY up direct_asset_url method between GraphQL and REST API"

What does this MR do and why?

Refactors duplicate presentation logic into a dedicated presenter class Releases::LinkPresenter

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

To setup a release with an asset link in a project

  1. Create a new release
  2. On the new release form, add a URL to the Release assets section of the form
  3. Note the project ID and full path you just created the release in

To validate the REST API use the endpoint http://<GITLAB_URL>/api/v4/projects/<PROJECT_ID>/releases

For GraphQL, use the query

query {
  project(fullPath: “<PROJECT_FULL_PATH>”) {
    releases(first: 1) {
      nodes {
        assets {
          links {
            nodes {
              id
              name
              url
              directAssetUrl
              linkType
              external
            }
          }
        }
      }
    }
  }
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #246811 (closed)

Edited by Allen Cook

Merge request reports