Page MenuHomePhabricator

URL field becomes `Special:Block/<username1>?title=Special:Block/<username2>` when blocking two users in succession
Closed, ResolvedPublic3 Estimated Story PointsBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Enable MultiBlocks ($wgUseCodexSpecialBlock = true; and $wgEnableMultiBlocks = true;)
  • Visit Special:Log/block
  • Click the "Remove block" link to unblock a currently blocked account
  • You are taken to /w/index.php?title=Special:Block/<username1>&id=<id>&remove=1
  • Press the "Cancel" or "Remove block" buttons (it doesn't actually matter which one)
  • In the "Target" field in the resulting form, type another valid username

What happens?:

  • The resulting URL is /wiki/Special:Block/<username2>?title=Special:Block/<username1>&id=<id>&remove=1

What should have happened instead?:

  • The URL that appears basically has ?title= twice (since /wiki/<Title> is the same as /w/index.php?title=<Title>. It should only appear once. Also, the &id= and &remove= query params are superfluous after having dealt with the first user.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
MediaWiki 1.44.0-alpha (46537e0)

Other information (browser name/version, screenshots, etc.):

Derived Requirement

Ensure that when blocking or unblocking multiple users in succession using Special:Block (with MultiBlocks and Codex enabled), the URL updates cleanly without duplicating the ?title= parameter or carrying over irrelevant parameters like &id= and &remove= from the previous user action.

Test Steps

Test Case 1: Ensure clean URL after blocking a second user

  1. Enable MultiBlocks ($wgUseCodexSpecialBlock = true; $wgEnableMultiBlocks = true;) on the test wiki.
  2. Visit Special:Log/block.
  3. Click "Remove block" for a currently blocked user (User1).
  4. You are navigated to /w/index.php?title=Special:Block/User1&id=<id>&remove=1.
  5. Press "Cancel" or "Remove block" (either action).
  6. In the now open block form, type a different valid username (User2) into the "Target" field.
  7. ✅❓❌⬜ AC1: Confirm that the resulting URL correctly updates to /wiki/Special:Block/User2 without retaining ?title=Special:Block/User1, &id=, or &remove= parameters and no duplicates after switching to another user..

Test Case 2: Switch to multiple users back-to-back without submitting a block

  1. After arriving at Special:Block/User1 with stale parameters (&id=, &remove=), type a second username (User2) into the target field.
  2. Without submitting, immediately change the target field again to a third username (User3).
  3. ✅❓❌⬜ AC2: Confirm that the URL updates correctly for User3 and that no old parameters (&id=, &remove=) from User1 or User2 persist.

QA Results - Test Beta

ACStatusDetails
1T391571#10781772
2T391571#10781772

Event Timeline

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

There are some other conditions that can lead to this too, most notably when pressing the browser's "back" button to return to Special:Block from somewhere else.

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

[mediawiki/core@master] SpecialBlock [Codex]: update URL when target, block ID or remove changes

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

Change #1136003 merged by jenkins-bot:

[mediawiki/core@master] SpecialBlock [Codex]: update URL when target, block ID or remove changes

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

@MusikAnimal This may be fine, but I just wanted to confirm this is what is expected in the URL as seen in the gifs for AC1 and AC2. Also when you switch to another user, both usernames are now shown in the URL or is it supposed to be just the one you changed to? For AC2, when you switch multiple times, that is the correct URL change?

Test Result - Beta

Status: ❓Need More Info
Environment: beta/testwiki
OS: macOS Sequoia 15.3.2
Browser: Chrome 135
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Ensure clean URL after blocking a second user

  1. Enable MultiBlocks ($wgUseCodexSpecialBlock = true; $wgEnableMultiBlocks = true;) on the test wiki.
  2. Visit Special:Log/block.
  3. Click "Remove block" for a currently blocked user (User1).
  4. You are navigated to /w/index.php?title=Special:Block/User1&id=<id>&remove=1.
  5. Press "Cancel" or "Remove block" (either action).
  6. In the now open block form, type a different valid username (User2) into the "Target" field.
  7. AC1: Confirm that the resulting URL correctly updates to /wiki/Special:Block/User2 without retaining ?title=Special:Block/User1, &id=, or &remove= parameters and no duplicates after switching to another user.
CancelRemove
2025-04-28_12-30-56.mp4.gif (822×1 px, 2 MB)
2025-04-28_12-36-30.mp4.gif (822×1 px, 2 MB)

Test Case 2: Switch to multiple users back-to-back without submitting a block

  1. After arriving at Special:Block/User1 with stale parameters (&id=, &remove=), type a second username (User2) into the target field.
  2. Without submitting, immediately change the target field again to a third username (User3).
  3. AC2: Confirm that the URL updates correctly for User3 and that no old parameters (&id=, &remove=) from User1 or User2 persist.

2025-04-28_12-49-58.mp4.gif (824×1 px, 2 MB)

Oh dear. Yes, there is more work to do here.

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

[mediawiki/core@master] SpecialBlock [Codex]: remove 'title' from query string when updating URL

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

I don't know if there's a policy or guideline about this, but from my anecdotal (and 20+ year) experience, we rarely* see any URL queries when the URL is /wiki/Something; if there are any URL queries, the URL is usually also changed to /w/index.php?title=Something&other=queries. Should that perhaps be a goal for the new Special:Block too (maybe a separate task is better)?

(*) The only exception I can think of is Special:RecentChanges and Special:Watchlist, ever since the advanced filtering features were launched.

Change #1139562 merged by jenkins-bot:

[mediawiki/core@master] SpecialBlock [Codex]: remove 'title' from query string when updating URL

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

I don't know if there's a policy or guideline about this, but from my anecdotal (and 20+ year) experience, we rarely* see any URL queries when the URL is /wiki/Something; if there are any URL queries, the URL is usually also changed to /w/index.php?title=Something&other=queries. Should that perhaps be a goal for the new Special:Block too (maybe a separate task is better)?

(*) The only exception I can think of is Special:RecentChanges and Special:Watchlist, ever since the advanced filtering features were launched.

There is no difference from a technical standpoint. Those PHP-generated routes like /w/index.php? are probably from before short URLs were introduced, or the technical complexity in those cases just made it easier to not use the shorter variant (I don't really know).

In our case, we're not even telling it to use the short form, rather mw.Title is doing that for us. That might explain why other JavaScript applications like Enhanced Recent Changes also construct URLs in this way.

At any rate, I would think the short form is always preferred over the long, simply for readability.

@MusikAnimal Confirmed that the resulting URL correctly updates to /wiki/Special:Block/User2 without retaining ?title=Special:Block/User1, &id=, or &remove= parameters and no duplicates after switching to another user in the URL as seen in the gifs. I will now mark this as Resolved. Thanks for all your work!

Test Result - Beta

Status: ✅ PASS
Environment: beta/testwiki
OS: macOS Sequoia 15.3.2
Browser: Chrome 135
Device: MBA
Emulated Device: NA

Test Artifact(s):

https://test.wikipedia.beta.wmflabs.org/wiki/Special:Block/Betatester
Special:log/block

Test Steps

Test Case 1: Ensure clean URL after blocking a second user

  1. Enable MultiBlocks ($wgUseCodexSpecialBlock = true; $wgEnableMultiBlocks = true;) on the test wiki.
  2. Visit Special:Log/block.
  3. Click "Remove block" for a currently blocked user (User1).
  4. You are navigated to /w/index.php?title=Special:Block/User1&id=<id>&remove=1.
  5. Press "Cancel" or "Remove block" (either action).
  6. In the now open block form, type a different valid username (User2) into the "Target" field.
  7. AC1: Confirm that the resulting URL correctly updates to /wiki/Special:Block/User2 without retaining ?title=Special:Block/User1, &id=, or &remove= parameters and no duplicates after switching to another user.
CancelRemove
2025-04-30_10-30-50.mp4.gif (826×1 px, 3 MB)
2025-04-30_11-44-34.mp4.gif (824×1 px, 3 MB)

Test Case 2: Switch to multiple users back-to-back without submitting a block

  1. After arriving at Special:Block/User1 with stale parameters (&id=, &remove=), type a second username (User2) into the target field.
  2. Without submitting, immediately change the target field again to a third username (User3).
  3. AC2: Confirm that the URL updates correctly for User3 and that no old parameters (&id=, &remove=) from User1 or User2 persist.

2025-04-30_10-32-36.mp4.gif (820×1 px, 3 MB)

GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF updated Other Assignee, removed: GMikesell-WMF.