Page MenuHomePhabricator

Hide action restrictions behind feature flag in ApiQueryBlocks
Open, Needs TriagePublicBUG REPORT

Description

What is the problem?

If I disabled action restrictions (i.e. $wgEnablePartialActionBlocks = false) and go to action=query&list=blocks, any action restrictions on blocks still appear. E.g.:

{
                "id": 57,
                "user": "Adam",
                "by": "Admin",
                ...
                "restrictions": {
                    "": [
                        "upload",
                        "move",
                        "create"
                    ]
                }
            }

(Notice also the key is blank "")

We might want to hide them instead, otherwise it might be misleading.

On my local, I also get: Notice: Undefined index: action in /var/www/html/w/includes/api/ApiQueryBlocks.php on line 340.

This is similar to T282457.

Steps to reproduce problem
  1. Enable action restriction blocks (i.e. $wgEnablePartialActionBlocks = true;)
  2. Block a user from one or more actions
  3. Disable action restrictions (i.e. $wgEnablePartialActionBlocks = false;)
  4. Go to /w/api.php?action=query&list=blocks&bkprop=id|user|by|restrictions

Expected behavior: The block you created in step 2 should not show action restrictions
Observed behavior: The action restrictions show

Environment

Wiki(s): MediaWiki 1.37.0-alpha (01c8b45) 07:19, 12 May 2021