Page MenuHomePhabricator

Codex Special:Block: Admins should be able to create a partial block with multiple namespaces
Closed, ResolvedPublic

Description

Background
Admins will sometimes want to block a target from accessing certain namespaces, and allow a target to interact with other types of content

user story
As an admin, I want to block a user from performing specific actions on specific namespaces, so that I can direct their attention towards more positive behavior

requirements / acceptance criteria
Given that I am an admin creating a new block, when I select partial blocks, the "namespace" text field should appear, and I should be able to search for a given namespace.

  • There should be a predefined list of namespaces in a dropdown menu
  • the admin should be able to filter the namespaces by typing
  • Admins should be able to select multiple namespaces
  • Clicking "x" on a ChipInput should remove a namespace

Implement Namespaces field for partial blocks in Codex. This field will allow admins to select the Namespaces they want to apply the block for.

The namespace field should look and feel as defined in Figma file

Derived Requirement

In Codex Special:Block, allow admins to create partial blocks with multiple namespaces. When an admin selects the partial block option, a "Namespaces" field should appear, displaying a dropdown menu with a predefined list of namespaces. Admins should be able to filter namespaces by typing, select multiple namespaces, and remove selected namespaces by clicking "x" on the corresponding ChipInput.

BDD

gherkin
Feature: Partial Block with Multiple Namespaces in Codex Special:Block

Scenario: Display "Namespaces" field when partial block is selected
  Given the admin is creating a new block
  When the admin selects the partial block option
  Then the "Namespaces" field should be displayed

Scenario: Filter namespaces by typing in the dropdown menu
  Given the "Namespaces" field is visible in the partial block options
  When the admin begins typing in the "Namespaces" field
  Then the dropdown menu should display only namespaces matching the typed characters

Scenario: Select multiple namespaces for partial block
  Given the "Namespaces" field is visible in the partial block options
  When the admin selects multiple namespaces from the dropdown menu
  Then each selected namespace should appear as a ChipInput in the "Namespaces" field

Scenario: Remove a selected namespace by clicking "x" on the ChipInput
  Given multiple namespaces are selected in the "Namespaces" field
  When the admin clicks "x" on a specific ChipInput
  Then that namespace should be removed from the "Namespaces" field

Test Result - Beta|Prod

Status: ✅ PASS / ❓Need More Info / ❌ FAIL
Environment: beta/xyzwiki
OS: macOS Sonoma 15.0
Browser: Chrome 130
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Display "Namespaces" Field When Partial Block is Selected

  1. Begin creating a new block in the Codex Special:Block form.
  2. Select the "Partial block" option.
  3. ✅❓❌⬜ AC1: Confirm that the "Namespaces" field appears when partial block is selected.

Test Case 2: Filter Namespaces by Typing in the Dropdown Menu

  1. Begin creating a new block in the Codex Special:Block form.
  2. Select the "Partial block" option.
  3. In the "Namespaces" field, start typing a namespace name.
  4. ✅❓❌⬜ AC2: Confirm that the dropdown menu filters namespaces based on the typed characters.

Test Case 3: Select Multiple Namespaces for Partial Block

  1. Begin creating a new block in the Codex Special:Block form.
  2. Select the "Partial block" option.
  3. In the "Namespaces" field, select multiple namespaces from the dropdown menu.
  4. ✅❓❌⬜ AC3: Confirm that each selected namespace appears as a ChipInput in the "Namespaces" field.

Test Case 4: Remove a Selected Namespace by Clicking "x" on the ChipInput

  1. Begin creating a new block in the Codex Special:Block form.
  2. Select the "Partial block" option.
  3. In the "Namespaces" field, select multiple namespaces.
  4. Click "x" on one of the ChipInputs for a selected namespace.
  5. ✅❓❌⬜ AC4: Confirm that the selected namespace is removed from the "Namespaces" field after clicking "x".

QA Results - Beta

Details

SubjectRepoBranchLines +/-
mediawiki/coremaster+165 -3
Customize query in gerrit

Event Timeline

JWheeler-WMF renamed this task from Special:Block form: Add 'Namespaces' multi select for partial blocks to Admins should be able to create a partial block with multiple namespaces .May 24 2024, 3:29 PM
JWheeler-WMF updated the task description. (Show Details)

Change #1039816 had a related patch set uploaded (by Dmaza; author: Dmaza):

[mediawiki/core@master] [WIP]

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

dmaza removed dmaza as the assignee of this task.Jun 20 2024, 9:27 PM
dmaza subscribed.

It this already done, or something more specific in the UI than the title suggests? Admins can already place p-blocks on multiple namespaces:

image.png (216×772 px, 14 KB)

Xaosflux lowered the priority of this task from High to Medium.Aug 28 2024, 7:41 PM

@HMonroy can you provide additional information on this ask? Is this only about a specific UI element, not the underlying blocking capability?

MusikAnimal raised the priority of this task from Medium to High.Aug 30 2024, 7:50 PM
MusikAnimal subscribed.

@HMonroy can you provide additional information on this ask? Is this only about a specific UI element, not the underlying blocking capability?

This is a child task of T358934: Implement the existing special:block form in Codex, which is about converting the existing Special:Block form to use Codex. T345291 is the missing functionality in Codex. Our other option is to use a bunch checkboxes instead (eww!).

I'll reword the title for clarity.

MusikAnimal renamed this task from Admins should be able to create a partial block with multiple namespaces to Codex Special:Block: Admins should be able to create a partial block with multiple namespaces.Aug 30 2024, 7:51 PM
MusikAnimal added a subscriber: Michael.

As per discussion with DST and @Michael, I will experiment with using a port of MediaWiki-extensions-CommunityConfiguration NamespacesControl for now until T345291 is resolved. I'll do the same for T362718, using PageTitlesControl. Thanks again to Michael for the pointers.

MusikAnimal changed the task status from Stalled to Open.Oct 1 2024, 10:31 PM

Change #1039816 abandoned by Samwilson:

[mediawiki/core@master] [WIP]

Reason:

Superseded by I53739bcdd63870fbfb57bc96298fc8d467bdfc2b

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

I think all the work for this has been done as part of T362718: Admins should be able to set a page(s) level block, is that right? This task is in review now, but it looks like it's probably alright to move on to QA.

@MusikAnimal Please review AC2 and AC3, thanks!

Test Result - Test Beta

Status: ❓Need More Info for AC2 & AC3
Environment: Test Beta
OS: macOS Sonoma 15.0
Browser: Chrome 130
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Display "Namespaces" Field When Partial Block is Selected

  1. Begin creating a new block in the Codex Special:Block form.
  2. Select the "Partial block" option.
  3. AC1: Confirm that the "Namespaces" field appears when partial block is selected.

2024-10-31_15-21-00.mp4.gif (706×920 px, 406 KB)

Test Case 2: Filter Namespaces by Typing in the Dropdown Menu

  1. Begin creating a new block in the Codex Special:Block form.
  2. Select the "Partial block" option.
  3. In the "Namespaces" field, start typing a namespace name.

4.❓ AC2: Confirm that the dropdown menu filters namespaces based on the typed characters.

If I type "t", it supposed to only show the words that start with "t" or any word with "t" in it? Also in the example since I was typing "ta" for talk, it didn't go up to the top where the word "Talk" is the first word

2024-10-31_15-31-43.mp4.gif (988×898 px, 1 MB)

Test Case 3: Select Multiple Namespaces for Partial Block

  1. Begin creating a new block in the Codex Special:Block form.
  2. Select the "Partial block" option.
  3. In the "Namespaces" field, select multiple namespaces from the dropdown menu.
  4. AC3: Confirm that each selected namespace appears as a ChipInput in the "Namespaces" field.

Is this supposed to be only when you click on the word with a mouse or are you also able to type it and press enter? Just wondering because I typed "Talk" and it will go through, only if click on it.

2024-10-31_15-34-02.mp4.gif (910×966 px, 837 KB)

Test Case 4: Remove a Selected Namespace by Clicking "x" on the ChipInput

  1. Begin creating a new block in the Codex Special:Block form.
  2. Select the "Partial block" option.
  3. In the "Namespaces" field, select multiple namespaces.
  4. Click "x" on one of the ChipInputs for a selected namespace.
  5. AC4: Confirm that the selected namespace is removed from the "Namespaces" field after clicking "x".

2024-10-31_15-40-03.mp4.gif (954×986 px, 1 MB)

4.❓ AC2: Confirm that the dropdown menu filters namespaces based on the typed characters.

**//If I type "t", it supposed to only show the words that start with "t" or any word with "t" in it?

I made it a fuzzy search on purpose, though no one asked for this. Your example is the prime reason -- look how easy it is to show all Talk namespaces now! :)

Also in the example since I was typing "ta" for talk, it didn't go up to the top where the word "Talk" is the first word//**

The Codex component we're using doesn't appear to do this sort of auto-scrolling by default. We probably can make it so but it seems like a very minor issue, and perhaps something that should be changed upstream in Codex. It looks like the old Special:Block (which uses OOUI) doesn't do this, either.

  1. AC3: Confirm that each selected namespace appears as a ChipInput in the "Namespaces" field.

Is this supposed to be only when you click on the word with a mouse or are you also able to type it and press enter? Just wondering because I typed "Talk" and it will go through, only if click on it.

Good question! Comparing with the old Special:Block, it looks like it will automatically select the first result. That seems like sensible behaviour I guess… and it does look like something we need to code (as opposed to the Codex component doing it for us). I will look into it, but will time box to just an hour or so. Like the above, I don't think this is a major issue.

Personally I've always used the arrow keys + Enter to make my selection after I type into one of these kind of inputs. That's usually fewer keystrokes then typing it out in full.

  1. AC3: Confirm that each selected namespace appears as a ChipInput in the "Namespaces" field.

Is this supposed to be only when you click on the word with a mouse or are you also able to type it and press enter? Just wondering because I typed "Talk" and it will go through, only if click on it.

Good question! Comparing with the old Special:Block, it looks like it will automatically select the first result. That seems like sensible behaviour I guess… and it does look like something we need to code (as opposed to the Codex component doing it for us). I will look into it, but will time box to just an hour or so. Like the above, I don't think this is a major issue.

Personally I've always used the arrow keys + Enter to make my selection after I type into one of these kind of inputs. That's usually fewer keystrokes then typing it out in full.

I've looked into this, and the Codex examples don't have this behaviour. We also aren't able to control it, so it would need to be fixed in Codex if this is desired. However again, I think it's a minor issue.

@GMikesell-WMF - AC2 is OK by me. I think the fuzzy search is useful.

@CCiufo-WMF - is there an intended behavior for a form input when a user presses enter on a dropdown? It seems like we are only allowing people to select a dropdown based on click.

@CCiufo-WMF - is there an intended behavior for a form input when a user presses enter on a dropdown? It seems like we are only allowing people to select a dropdown based on click.

Navigating to a menu item and pressing enter does select it (see the Codex demo), but if what you type exactly matches one of the menu items, it is not currently selected by default. This was an intentional decision, but we are exploring automatic selection in T376466.

GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF moved this task from QA to Done on the Community-Tech (Jackal (not a fox) Fox) board.