Page MenuHomePhabricator

SpecialBlock: update the "remove" menu item in Active Blocks
Closed, ResolvedPublic

Description

ATM the "remove" menu item in Active Blocks links to Special:Unblock/username

Update this to link to Special:Unblock/?id=<blockid>, and in the Vue app capture the link click, and when it is clicked

Remove this link, and instead handle it as a button within the Vue app. When it is clicked:

  • use the unblock API to edit remove the block
  • update the active block table when the API request is successful
  • if the API request is not successful, display an error

https://www.figma.com/design/3PthdmimQ8FiuhGIsLhmZi/Multiblock?node-id=2523-35800&t=V3XzVft9pkiozqit-4

Derived Requirement:

Update the "remove" menu item in Active Blocks to link to Special:Unblock/?id=<blockid> instead of Special:Unblock/username. In the Vue app, implement the following functionality:

  • Capture the link click event.
  • Use the unblock API to edit the block.
  • Update the Active Blocks table when the unblock API request is successful.
  • Display an error message if the unblock API request fails.
Test Steps

Test Case 1: Ensure "Remove" Menu Item Links to Correct URL

  1. Open the Active Blocks page.
  2. Locate the "remove" menu item next to an active block.
  3. Click the "remove" menu item.
  4. ✅❓❌⬜ AC1: Verify that the URL is updated to Special:Unblock/?id=<blockid>.

Test Case 2: Ensure API is Called to Unblock a User

  1. Open the Active Blocks page.
  2. Locate and click the "remove" menu item next to an active block.
  3. Capture the network request.
  4. ✅❓❌⬜ AC2: Confirm that the unblock API is called with the appropriate block ID.

Test Case 3: Ensure Active Block Table is Updated After Successful API Request

  1. Open the Active Blocks page.
  2. Locate and click the "remove" menu item next to an active block.
  3. Wait for the API request to complete successfully.
  4. ✅❓❌⬜ AC3: Verify that the active block table is updated to reflect the successful unblock.

Test Case 4: Ensure Error is Displayed After Failed API Request

  1. Open the Active Blocks page.
  2. Locate and click the "remove" menu item next to an active block.
  3. Simulate a failed API request.
  4. ✅❓❌⬜ AC4: Ensure an error message is displayed when the API request fails.

QA Results - Local

Environment

Local Mediawiki: 1.44.0-alpha (e132441) 20:01, 3 February 2025

Event Timeline

dmaza changed the task status from Open to Stalled.Nov 19 2024, 10:11 PM
dmaza subscribed.
HMonroy subscribed.

The frontend implementation can be done, but T378148 will need to be done for proper QA.

Samwilson changed the task status from Stalled to In Progress.Dec 18 2024, 4:49 AM

Change #1105204 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/core@master] SpecialBlock: Add confirmation dialog when removing blocks

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

Change #1105204 merged by jenkins-bot:

[mediawiki/core@master] SpecialBlock: Add confirmation dialog when removing blocks

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

Change #1110906 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/core@master] SpecialBlock: Don't override default removal reason

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

Change #1110906 merged by jenkins-bot:

[mediawiki/core@master] SpecialBlock: Don't override default removal reason

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

@Samwilson Please see the remarks below, thanks!

  1. In the task description it says "use the unblock api to edit the block". Besides "edit", did you mean "remove"? If not, can you explain this one more?
  2. See response in AC1
  3. See Other Issues

Test Result - Local

Status: ❓Need More Info
Environment: Local 1.44.0-alpha (e132441) 20:01, 3 February 2025
OS: macOS Sequoia 15.2
Browser: Chrome 132
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Ensure "Remove" Menu Item Links to Correct URL

  1. Open the Active Blocks page.
  2. Locate the "remove" menu item next to an active block.
  3. Click the "remove" menu item.
  4. AC1: Verify that the URL is updated to Special:Unblock/?id=<blockid>.

I see the unblock ID in Network preview as seen in the gif for AC2 but where am I supposed to see in the URL

Test Case 2: Ensure API is Called to Unblock a User

  1. Open the Active Blocks page.
  2. Locate and click the "remove" menu item next to an active block.
  3. Capture the network request.
  4. AC2: Confirm that the unblock API is called with the appropriate block ID.

2025-02-03_16-36-12.mp4.gif (1×1 px, 1 MB)

Test Case 3: Ensure Active Block Table is Updated After Successful API Request

  1. Open the Active Blocks page.
  2. Locate and click the "remove" menu item next to an active block.
  3. Wait for the API request to complete successfully.
  4. AC3: Verify that the active block table is updated to reflect the successful unblock.

See AC2

Test Case 4: Ensure Error is Displayed After Failed API Request

  1. Open the Active Blocks page.
  2. Locate and click the "remove" menu item next to an active block.
  3. Simulate a failed API request.
  4. AC4: Ensure an error message is displayed when the API request fails.

2025-02-03_16-36-12.mp4.gif (1×1 px, 1 MB)

❓ Other Issues- I'm not sure how much you want the removal block to match figma but you can see there are a few differences with the wording by the checkbox and an ":" after Reason

LocalFigma
2025-02-03_16-48-33.png (503×874 px, 64 KB)
2025-02-03_16-46-46.png (491×829 px, 42 KB)

In the task description it says "use the unblock api to edit the block". Besides "edit", did you mean "remove"? If not, can you explain this one more?

Yep, it should've said remove; I've updated the description.

I removed the requirement to have the remove button link to Special:Unblock, because per T382539 we're going to deprecate Special:Unblock.

❓ Other Issues- I'm not sure how much you want the removal block to match figma but you can see there are a few differences with the wording by the checkbox and an ":" after Reason

Good catch about these messages. The watch checkbox label has been changed in the block form since this task was written, and the removal dialog uses the same message as in the block edit form. So I think these are fine as-is. There's going to be another design review anyway, so that'll catch any small things.

Thanks for being so thorough!