|Resolved||None||T197119 Update Visual Editor block notice to be page specific|
|Resolved||dbarratt||T194585 Expose whether a user is blocked from editing a specific page via the API|
By design the API—and by extension the visual editor—won't let you save an edit if you're blocked; if the user tries to do so, then the API returns an error, and the visual editor passes on to the user the value of the key info from the response, which in the case of a block is "You have been blocked from editing". If the API gives a different or more specific error message, visual editor will use that instead.
So, from what I can see right now, any changes in the API would be sufficient, and there is nothing to change in the visual editor. Is there something else you had in mind?
Are you saying that Visual Editor does not give you a block notice before you start editing?
For instance, without Visual Editor, if I go to the edit page, the page tells me I'm blocked before I attempt to edit.
Ah, yes. The content doesn't come from the API, and it's not normally called a block notice, so I didn't realise you were talking about that. Sorry for the confusion! (You know, I don't think it actually has a name itself. It's kind of an edit notice, but not really. How confusing...)
The content of that messages comes from MediaWiki:Blockedtext, or whatever value the local wikis have overridden it to be. Further overriding local overrides is generally not recommended. If you're aiming to get that updated, then you'll need to reach out to communities so that they can change it.
I assume you are using the API to determine if the user should be shown the message or not? The problem is is that when we implement Partial Blocks, users will be blocked on a per-page basis, rather than on a whole-site basis (i.e. they might be blocked from the "Bugs Bunny" page but not the "Donald Duck" page).
The logic as to whether the message is shown or not is in MediaWiki, not the visual editor. When you start editing, the visual editor queries for metadata associated with the page; this includes any page notices, which is what the message you're seeing is. The visual editor doesn't specifically check whether you're blocked or not, because it doesn't need to. So, no specific query for page-specific blocks should be necessary, because whatever new page notice is introduced for page-specific blocks will be shown in the visual editor as a result of the metadata query that's already carried out.
Here's an example of the query the visual editor uses when you start editing:
If you're logged in on an unblocked account, you'll see this in the response:
If you're logged in on a blocked account, the exact same query will give you this response:
"notices":["<table id=\"mw-blocked-text\" style=\"border:2px solid #000; […]