Quick action error not displayed at content editor

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

From !180205 (comment 2332372924)

When I use the /type Incident quick action on an issue with a parent we display a page-level error instead of a local content editor error.

It looks like some odd behavior when both errors for the quick action and top level errors are available. See response JSON below. The reason might be that the error is generated from the model app/models/work_item.rb:308 and so a validation error and nothing we usually handle through quick actions and execution errors.

quickActionsStatus.errorMessages are displayed close to the editor (I think this was introduced recently). But if (top-level) errors is present we throw an error and let it bubble up, so it displays as a page-level error.

Click to expand for response JSON
{
    "data": {
        "createNote": {
            "note": null,
            "quickActionsStatus": {
                "errorMessages": [
                    "Work item type cannot be changed to incident when linked to a parent epic."
                ],
                "messages": [
                    "Type changed successfully."
                ],
                "__typename": "QuickActionsStatus"
            },
            "errors": [
                "Validation Work item type cannot be changed to incident when linked to a parent epic."
            ],
            "__typename": "CreateNotePayload"
        }
    }
}

Also see screenshot

image

The code is in app/assets/javascripts/work_items/components/notes/work_item_add_note.vue:

  1. We perform the mutation in 245 and
  2. call onNoteUpdate on update. This throws the error if anything is present in errors.
  3. If it wouldn't throw the error the message in quickActionsStatus.errorMessages would display next to the editor.
  4. There are probably valid use cases for letting this bubble up.

Maybe we could also check for the existence of quickActionsStatus.errorMessages and then don't throw the error... 🤔

Edited by 🤖 GitLab Bot 🤖