Page MenuHomePhabricator

Codex Special:Block: Form not being reset properly
Closed, ResolvedPublic5 Estimated Story PointsBUG REPORT

Description

What is the problem?

I have observed several circumstances where the Special:Block form is not reset properly. Some of these seem to be regressions of bugs which in the past were fixed.

These include:

  1. Form not being reset after successful submit (originally fixed in T379215)
  2. Form not being reset while editing block and clicking "Add block" to try to create a new block
  3. Form not being reset when switching block targets

There are possibly other examples that are yet to be found.

Steps to reproduce problem

One

  1. Go to Special:Block/<target> for a <target> that is already blocked
  2. Open the Active blocks accordion and click "Edit" on one of the rows
  3. Make a few changes to the block and click "Update block"
  4. Click "Add block"

Expected behaviour: The form should be reset to its blank state.
Observed behaviour: The form has the same state as when you submitted the form in step 3.

Two

  1. Go to Special:Block/<target> for a <target> that is already blocked
  2. Open the Active blocks accordion and click "Edit" on one of the rows
  3. Open the Active blocks accordion again (if necessary) and click "Add block"

Expected behaviour: The form should be reset to its blank state. Submitting the form should create a new block.
Observed behaviour: The state of the form is the same as in step 2. Submitting the form will update the block you selected in step 2.

Three

  1. Go to Special:Block/<target> for a <target> that is already blocked
  2. Open the Active blocks accordion and click "Edit" on one of the rows
  3. Change the Target input to a new target
  4. Click "Add block"
  5. Fill out the form and submit

Expected behaviour: The new target you entered in step 3 is blocked.
Observed behaviour: The original target from step 1 has its block updated.

Environment

Browser: Firefox 128.
Wiki(s): local docker MediaWiki 1.44.0-alpha (b3d4c9e) 08:27, 27 January 2025.

Screenshots

Derived Requirements

  1. Form Reset After Successful Submission:
    • After submitting a block update or a new block, the Special:Block form should reset to its default state.
  1. Form Reset When Switching Between Editing and Adding a Block:
    • If a user is editing an existing block and then clicks "Add block", the form should reset and allow the user to create a new block instead of retaining the previously edited block’s data.
  1. Form Reset When Changing the Block Target:
    • If a user edits a block and then changes the target user/IP, the form should reflect the new target when submitted, rather than modifying the previously selected target.
Test Steps

Test Case 1: Ensure Form Resets After Successful Submission

  1. Go to Special:Block/<target> for a <target> that is already blocked
  2. Open the Active blocks accordion and click "Edit" on one of the rows
  3. Make a few changes to the block and click "Update block"
  4. Click "Add block"
  5. ✅❓❌⬜ AC1: Verify that the form should be reset to its blank state.

Test Case 2: Ensure Form Resets When Switching from Edit Mode to Add Block

  1. Go to Special:Block/<target> for a <target> that is already blocked
  2. Open the Active blocks accordion and click "Edit" on one of the rows
  3. Open the Active blocks accordion again (if necessary) and click "Add block"
  4. ✅❓❌⬜ AC2: Confirm that the form should be reset to its blank state. Submitting the form should create a new block.

Test Case 3: Ensure Form Resets When Switching Targets

  1. Go to Special:Block/<target> for a <target> that is already blocked
  2. Open the Active blocks accordion and click "Edit" on one of the rows
  3. Change the Target input to a new target
  4. Click "Add block"
  5. Fill out the form and submit
  6. ✅❓❌⬜ AC3: Verify that the new target you entered in step 3 is blocked.

Test Case 4: Ensure Form Resets Properly When Clicking "Add Block" After Visiting an Existing Block ID

  1. Navigate to Special:Block/\<user\>?id=\<id\> for an existing block ID.
  2. Go to Contributions
  3. Select Change block
  4. Click Cancel
  5. Click "Add block".
  6. ✅❓❌⬜ AC4: Verify that the form resets immediately and allows for a new block to be created.

QA Results - Local

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

🙀 this might benefit from some tests when resolved (this time)

Change #1118585 had a related patch set uploaded (by HMonroy; author: HMonroy):

[mediawiki/core@master] Special:Block [Codex]: Reset form properly when adding a block

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

Change #1118585 merged by jenkins-bot:

[mediawiki/core@master] Special:Block [Codex]: Reset form properly when adding a block

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

Change #1119591 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/core@master] SpecialBlock [Codex]: Improve form reset logic and add tests

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

Change #1119591 merged by jenkins-bot:

[mediawiki/core@master] SpecialBlock [Codex]: Improve form reset logic and add tests

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

@HMonroy I have found another case, let me know if you want a separate bug:

  1. Visit Special:Block/<user>?id=<id> for an existing block ID
  2. Click "Add block"

Form is not reset and still updates the existing block. You need to click "Add block" a second time to get it to reset.

Also, in the above case if the existing block is indefinite, after you click "Add block" a second time the form is reset except the expiry. Then, you cannot submit the form (the "Add block" button is unresponsive) unless you first change the expiry time.

@HMonroy I have found another case, let me know if you want a separate bug:

  1. Visit Special:Block/<user>?id=<id> for an existing block ID
  2. Click "Add block"

Form is not reset and still updates the existing block. You need to click "Add block" a second time to get it to reset.

Also, in the above case if the existing block is indefinite, after you click "Add block" a second time the form is reset except the expiry. Then, you cannot submit the form (the "Add block" button is unresponsive) unless you first change the expiry time.

Taking a look. Thanks!

@HMonroy The first 3 test cases have now passed. I did create another test case based off of T384822#10595591 which did fail. If you do want this to be a separate bug since this was not part of the original, please let us know. Thanks!

Test Result - Beta|Prod

Status: ❌ FAIL AC4
Environment: Local 1.44.0-alpha (f23c1d1)
00:28, 4 March 2025
OS: macOS Sonoma 15.3.1
Browser: Chrome 133
Device: MBA

Test Artifact(s):

Test Steps

Test Case 1: Ensure Form Resets After Successful Submission

  1. Go to Special:Block/<target> for a <target> that is already blocked
  2. Open the Active blocks accordion and click "Edit" on one of the rows
  3. Make a few changes to the block and click "Update block"
  4. Click "Add block"
  5. AC1: Verify that the form should be reset to its blank state.
Chrome
2025-03-03_15-24-11.mp4.gif (808×1 px, 1 MB)

Test Case 2: Ensure Form Resets When Switching from Edit Mode to Add Block

  1. Go to Special:Block/<target> for a <target> that is already blocked
  2. Open the Active blocks accordion and click "Edit" on one of the rows
  3. Open the Active blocks accordion again (if necessary) and click "Add block"
  4. AC2: Confirm that the form should be reset to its blank state. Submitting the form should create a new block.
Safari
2025-03-03_16-03-11.mp4.gif (846×1 px, 1 MB)

Test Case 3: Ensure Form Resets When Switching Targets

  1. Go to Special:Block/<target> for a <target> that is already blocked
  2. Open the Active blocks accordion and click "Edit" on one of the rows
  3. Change the Target input to a new target
  4. Click "Add block"
  5. Fill out the form and submit
  6. AC3: Verify that the new target you entered in step 3 is blocked.
Firefox
2025-03-03_16-00-45.mp4.gif (838×1 px, 3 MB)

Based off of T384822#10595591
Test Case 4: Ensure Form Resets Properly When Clicking "Add Block" After Visiting an Existing Block ID

  1. Navigate to Special:Block/\<user\>?id=\<id\> for an existing block ID.
  2. Click "Add block".
  3. AC1: Verify that the form resets immediately and allows for a new block to be created.
Chrome
2025-03-03_16-06-17.mp4.gif (810×1 px, 786 KB)

@HMonroy So when trying to test this, it does have the "Add block" to add another block but when I go to "Contributions" and select "change block", I don't have the option to "Add Block" but only have "Update block" now.

Environment: Local 1.44.0-alpha (bc99458) 18:03, 5 March 2025

Based off of T384822#10595591
Test Case 4: Ensure Form Resets Properly When Clicking "Add Block" After Visiting an Existing Block ID

  1. Navigate to Special:Block/\<user\>?id=\<id\> for an existing block ID.
  2. Click "Add block".
  3. AC1: Verify that the form resets immediately and allows for a new block to be created.
Chrome
2025-03-05_13-25-53.mp4.gif (828×1 px, 1 MB)

@GMikesell-WMF when you are editing a block, which is what is happening when we are changing a block, there is no "Add block" button. It's either the edit form, or cancel the edit form, to see the "Add block" button. It's either the form or add block button.

@HMonroy I see now. Ok it's now verified that the form is now reset when you click on Cancel as seen in the gifs below. I will make this now as Resolved. Thanks for all your work!

Test Result - Beta|Prod

Status: ✅ PASS
Environment: Local 1.44.0-alpha (bc99458) 18:03, 5 March 2025
OS: macOS Sonoma 15.3.1
Browser: Chrome 133
Device: MBA

Test Artifact(s):

Test Steps

Test Case 1: Ensure Form Resets After Successful Submission

  1. Go to Special:Block/<target> for a <target> that is already blocked
  2. Open the Active blocks accordion and click "Edit" on one of the rows
  3. Make a few changes to the block and click "Update block"
  4. Click "Add block"
  5. AC1: Verify that the form should be reset to its blank state.
Chrome
2025-03-03_15-24-11.mp4.gif (808×1 px, 1 MB)

Test Case 2: Ensure Form Resets When Switching from Edit Mode to Add Block

  1. Go to Special:Block/<target> for a <target> that is already blocked
  2. Open the Active blocks accordion and click "Edit" on one of the rows
  3. Open the Active blocks accordion again (if necessary) and click "Add block"
  4. AC2: Confirm that the form should be reset to its blank state. Submitting the form should create a new block.
Safari
2025-03-03_16-03-11.mp4.gif (846×1 px, 1 MB)

Test Case 3: Ensure Form Resets When Switching Targets

  1. Go to Special:Block/<target> for a <target> that is already blocked
  2. Open the Active blocks accordion and click "Edit" on one of the rows
  3. Change the Target input to a new target
  4. Click "Add block"
  5. Fill out the form and submit
  6. AC3: Verify that the new target you entered in step 3 is blocked.
Firefox
2025-03-03_16-00-45.mp4.gif (838×1 px, 3 MB)

Based off of T384822#10595591
Test Case 4: Ensure Form Resets Properly When Clicking "Add Block" After Visiting an Existing Block ID

  1. Navigate to Special:Block/\<user\>?id=\<id\> for an existing block ID.
  2. Go to Contributions
  3. Select Change block
  4. Click Cancel
  5. Click "Add block".
  6. AC1: Verify that the form resets immediately and allows for a new block to be created.
Chrome- VectorChrome- Minerva
2025-03-05_13-43-15.mp4.gif (768×1 px, 1 MB)
2025-03-05_13-46-30.mp4.gif (832×924 px, 1 MB)
GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF updated Other Assignee, removed: GMikesell-WMF.

@GMikesell-WMF @HMonroy I am finding a variant of test case 3 where the form is not reset. Don't clear the target field before changing targets.

@GMikesell-WMF @HMonroy I am finding a variant of test case 3 where the form is not reset. Don't clear the target field before changing targets.

I have raised T389056.