Page MenuHomePhabricator

Add article form to Worklist tab
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: Inside the Worklist tab (T423612), organizers and registered participants need a way to add articles to the event worklist. This task implements the add-article form with a cross-wiki article input (autocomplete) and a wiki selector. The form submits to the POST /worklist REST API (T423559) and reloads the page so it reload article list that will be done in (task-9).

Type of story
  • Front end / Integration
Acceptance criteria
  • The add-article form is visible only to organizers and registered participants; it is not visible to viewers or non-participants.
  • The form contains an article title input with autocomplete (cross-wiki T423632), a wiki selector (approach TBD — T423632 for whether cross-wiki targets are technically supported/validated; T422733 / for how users pick wiki + title), and a submit button.
  • On submit, the form calls POST /worklist (T423559).
  • On 201 success: the form input clears and the article list (task-9) refreshes.
  • On 400 error (invalid or non-existent article): the user is shown the translated text returned by T423559 for campaignevents-worklist-invalid-article-error. Design for where to show the message: TBD. The form stays open.
  • On 400 or 422 (TBD) error (article already in worklist): same as the 400 case, but for campaignevents-worklist-article-already-exists.
Design
  • Design from T422733 is required before implementation. This task is blocked on design.
  • Also blocked by the investigation T423632
Messages and copy included
  • For happy path:
    • Form input clears; article list refreshes. No explicit success message required (the article appears in the list) (TBD: Decide if show a success message or not after refreshing).
      • Message key: campaignevents-worklist-add-article-button-label
        • Message text: TBD
        • Message suggestion: "Add article"
        • Context: label for the submit button in the add-article form
    • TBD — Messages for input fields and placeholders depend on design (T422733) after cross-wiki feasibility is known (T423632) and UX for wiki/title entry is settled (Q1b / T422733).
  • For unhappy path:
    • Message key: campaignevents-worklist-invalid-article-error
      • Message text: TBD
      • Message suggestion: (see T423559)
      • Context: user-visible error when the API returns 400; placement/presentation TBD (T422733)
    • Message key: campaignevents-worklist-article-already-exists
      • Message text: TBD
      • Message suggestion: (see T423559)
      • Context: user-visible error when the API returns 409; placement/presentation TBD (T422733)
Are there dependencies (on someone else or learning something new)?
  • Cross-wiki technical feasibility and validation must be settled before implementation assumes multi-wiki targets — [task-16](../task-16/task-16.md) (investigation).
  • Design from T422733 must be available before implementation.
Depends on
  • T423632 (cross-wiki feasibility & validation — must be decided before task-8 assumes articles from wikis other than the viewer’s local wiki)
  • T423559 (POST /worklist REST API must exist before the form can submit)
  • T423612 (Worklist tab shell must exist for the form to render inside)
  • T423606 (Worklist feature flag must be implemented)
Testing required?
  • Yes
  • Minimum testing to pass QA:
    • With feature flag ON: all Gherkin scenarios pass; 400/422 show the API-provided translated error text to the user (presentation per T422733 when available); form is hidden for viewers; 201 clears the form and refreshes the list.
    • With feature flag OFF: covered by T423612/task-12 (Worklist tab is not shown).
  • Tested end-to-end in: task-8 (this task) in combination with task-9 (article list refresh)
Technical details
  • Cross-wiki behaviour (whether and how non-local (wiki_id, page_title) targets are supported and validated) is pending T423632; until that investigation is closed, this task cannot be fully specified for that part of the flow.
  • Only for organizers and participants may be offered the add-article flow in the UI.
Split patches suggestion
  • Branch 1: Form + wiki/title capture UI (blocked until T423632 proves technical path; T422733 / for UX)
  • Branch 2: Autocomplete integration + error handling (400, 422) + i18n + article list refresh on success
Gherkin scenarios
NOTE: This are all drafts and we will refine them

Feature: Add article form in Worklist tab

  • Scenario: Form is visible to an organizer when the Worklist feature flag is ON
    • Given the Worklist feature flag is enabled
    • And I am an organizer of a contribution event
    • And I am viewing the Worklist tab on the EventDetails page
    • Then I see the add-article form with an article input and a submit button
  • Scenario: Form is visible to a registered participant when the Worklist feature flag is ON
    • Given the Worklist feature flag is enabled
    • And I am a registered participant of a contribution event
    • And I am viewing the Worklist tab on the EventDetails page
    • Then I see the add-article form with an article input and a submit button
  • Scenario: Form is not visible to a viewer when the Worklist feature flag is ON
    • Given the Worklist feature flag is enabled
    • And I am a viewer of an event (not a participant or organizer)
    • And I am viewing the Worklist tab on the EventDetails page
    • Then I do not see the add-article form
  • Scenario: Successful article submission clears the form and refreshes the list
    • Given the Worklist feature flag is enabled
    • And I am an organizer viewing the Worklist tab on the EventDetails page
    • And I have filled in a valid article title and the correct wiki for submission
    • When I submit the add-article form
    • And the POST /worklist API returns 201
    • Then the article input is cleared
    • And the article list refreshes to show the newly added article
  • Scenario: Invalid article shows the API error and keeps the form open
    • Given the Worklist feature flag is enabled
    • And I am an organizer viewing the Worklist tab on the EventDetails page
    • And I have entered an article title that does not exist on the selected wiki
    • When I submit the add-article form
    • And the POST /worklist API returns 400
    • Then I see the translated error text for "campaignevents-worklist-invalid-article-error"
    • And the form remains open with the entered title preserved
  • Scenario: Duplicate article shows the API error and keeps the form open
    • Given the Worklist feature flag is enabled
    • And I am an organizer viewing the Worklist tab on the EventDetails page
    • And I have entered an article title that is already in the worklist
    • When I submit the add-article form
    • And the POST /worklist API responds with a duplicate-article error per T423559 (exact HTTP status once the AC is finalized)
    • Then I see the translated error text for "campaignevents-worklist-article-already-exists"
    • And the form remains open with the entered title preserved

NOTE: More Gherkin scenarios will be added after this task's pending items are closed (T423632 cross-wiki feasibility/validation, design T422733, and any remaining API or copy decisions reflected in the acceptance criteria).