Draft: Return the persisted issue when updateIssue fails

What does this MR do and why?

When updateIssue fails, the payload now returns the issue as it is stored.

On a failed update, Mutations::Issues::Update returned the issue with the unsaved values still assigned in memory, so the payload showed values that were never saved, such as a rejected work item type or a new title. The mutation now resets the issue when the update has errors, as setConfidential, mergeRequestUpdate and updateSnippet already do.

This MR has no flag. It is a bug fix. The payload only changes on failed updates, where it now matches what is stored.

References

  • Part of the split of !260607 (merged).
  • No dependencies. Based on master.
  • Merge before !261249. Without it, updateIssue returns the rejected type when enforce_work_item_type_availability blocks a change.

How to set up and validate locally

  1. Call updateIssue with a new title and a type change that is rejected, for example changing an issue that has a child task to Task.
  2. The mutation returns the error.
  3. The returned issue still has its original title and type.

Specs:

  • spec/requests/api/graphql/mutations/issues/update_spec.rb

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist.

Edited by Alexandru Croitor

Merge request reports

Loading
Loading