Page MenuHomePhabricator

Add delete actions to worklist table
Open, In Progress, Needs TriagePublic

Description

NOTE: Remove sections that are not needed. Instead, leave the section and write NOT NEEDED as its content.

Background: The article list table (T423655) needs a delete action for authorised users. This task adds an Actions column to the table with a Remove button. Clicking Remove shows a confirmation dialog; on confirmation, the DELETE /worklist/{article_id} API (T423656) is called. The row is removed from the DOM on success. Permission rules differ by role: organizers see the button on every row; participants see it only on rows they added themselves; viewers and non-participants see no Actions column at all.

Type of story
  • Front end
Acceptance criteria
  • An Actions column is added to the worklist article table (T423655).
  • Organizers see a Remove button on every row.
  • Registered participants see a Remove button only on rows added by them.
  • Viewers and non-participants see no Actions column at all.
  • Clicking the Remove button opens a confirmation dialog before any API call is made.
  • Clicking Cancel in the confirmation dialog closes the dialog without deleting the article.
  • Clicking Confirm in the confirmation dialog calls the DELETE /worklist/{article_id} endpoint (T423656).
  • On successful deletion: the row is removed.
Design
  • Design from T422733 is required before implementation. This task is blocked on design approval.
Messages and copy included
  • For happy path:
    • On success a success notification is shown and the row is removed from the DOM (mirrors the contributions delete-actions pattern).
      • Message key: campaignevents-worklist-actions-column-header
        • Message text: "Actions"
        • Context: column header for the Actions column in the worklist article table
      • Message key: campaignevents-worklist-remove-button-label
        • Message text: "Remove"
        • Context: label for the Remove button in the Actions column of the worklist article table
      • Message key: campaignevents-worklist-remove-confirm-title
        • Message text: "Remove page from worklist?"
        • Context: title of the confirmation dialog shown before deleting an article from the worklist
      • Message key: campaignevents-worklist-remove-confirm-body
        • Message text: "This page will be removed from the worklist. This action cannot be undone."
        • Context: body text of the confirmation dialog shown before deleting an article from the worklist
      • Message key: campaignevents-worklist-remove-confirm-action
        • Message text: "Remove"
        • Context: label of the destructive primary button that confirms removal in the confirmation dialog
      • Message key: campaignevents-worklist-remove-confirm-cancel
        • Message text: "Cancel"
        • Context: label of the button that dismisses the confirmation dialog without removing the article
      • Message key: campaignevents-worklist-remove-success
        • Message text: "The page was removed from the worklist."
        • Context: success notification shown after an article is successfully removed from the worklist
  • For unhappy path:
    • Message key: campaignevents-worklist-remove-error
      • Message suggestion: "The page could not be removed from the worklist. Please try again."
      • Context: error notification shown when the DELETE API call fails (mirrors the contributions delete-actions pattern)
Are there dependencies (on someone else or learning something new)?
  • Design from T422733 must be available before implementation.
Depends on
  • T423655 (article list table must exist for the Actions column to be added to it)
  • T423656 (DELETE /worklist/{article_id} REST API must exist before the delete flow can call it)
Testing required?
  • Yes
  • Minimum testing to pass QA:
    • With feature flag ON: all Gherkin scenarios pass; organizer/participant/viewer visibility rules hold; confirm/cancel behavior is correct; row is removed on success.
    • With feature flag OFF: covered by T423612/T423606 (Worklist tab is not shown).
  • Tested end-to-end in: task-11 (this task)
Split patches suggestion
  • Branch 1: Actions column + permission-based visibility (organizer vs participant vs viewer)
  • Branch 2: Confirmation dialog + DELETE API call + row removal (fadeOut) + i18n
Gherkin scenarios
NOTE: This are all drafts and we will refine them

Feature: Delete action column in Worklist tab article table

  • Scenario: Organizer sees Remove button on all rows
    • Given the Worklist feature flag is enabled
    • And I am an organizer of an event with articles in its worklist
    • And I am viewing the Worklist tab on the EventDetails page
    • Then I see the "Actions" column in the article table
    • And every row has a "Remove" button
  • Scenario: Participant sees Remove button only on their own rows
    • Given the Worklist feature flag is enabled
    • And I am a registered participant who added some articles to the worklist
    • And I am viewing the Worklist tab on the EventDetails page
    • Then I see the "Actions" column in the article table
    • And only the rows I added have a "Remove" button
    • And rows added by other users do not have a "Remove" button
  • Scenario: Viewer sees no Actions column
    • Given the Worklist feature flag is enabled
    • And I am a viewer (not a participant or organizer) of an event
    • And I am viewing the Worklist tab on the EventDetails page
    • Then the article table does not have an "Actions" column
  • Scenario: Confirmation dialog appears before deletion
    • Given the Worklist feature flag is enabled
    • And I am an organizer viewing the Worklist tab on the EventDetails page
    • When I click the "Remove" button on an article row
    • Then a confirmation dialog appears with a title and body text
    • And no DELETE API call has been made yet
  • Scenario: Cancelling the dialog leaves the article untouched
    • Given the Worklist feature flag is enabled
    • And the confirmation dialog is open for an article
    • When I click the Cancel button in the dialog
    • Then the dialog closes
    • And the article row is still present in the table
    • And no DELETE API call is made
  • Scenario: Confirming deletion removes the row from the table
    • Given the Worklist feature flag is enabled
    • And the confirmation dialog is open for an article
    • When I click the Confirm button in the dialog
    • Then the DELETE /worklist/{article_id} API is called
    • And the article row is removed from the table

Event Timeline

Change #1298235 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Add delete actions to worklist table

https://gerrit.wikimedia.org/r/1298235