Page MenuHomePhabricator

Update Visual Editor block notice to be page specific
Closed, ResolvedPublic

Description

Once an API exists to check for a page-specific block (See T194585) Visual Editor should be updated to use this API to determine if the current user is blocked from editing the page.

Event Timeline

dbarratt created this task.Jun 13 2018, 2:29 PM
Restricted Application added subscribers: MGChecker, Aklapper. · View Herald TranscriptJun 13 2018, 2:29 PM
dbarratt renamed this task from Fix Visual Editor block notice to be page specific to Update Visual Editor block notice to be page specific.Jun 13 2018, 3:34 PM
TBolliger moved this task from Untriaged to Backlog on the Anti-Harassment board.Jun 13 2018, 4:43 PM

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?

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.

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.

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).

I assume you are using the API to determine if the user should be shown the message or not?

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:
https://en.wikipedia.beta.wmflabs.org/w/api.php?action=visualeditor&format=json&paction=metadata&page=San%20Francisco

If you're logged in on an unblocked account, you'll see this in the response:
"notices":[]
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; […]

Here's an example of the query the visual editor uses when you start editing:
https://en.wikipedia.beta.wmflabs.org/w/api.php?action=visualeditor&format=json&paction=metadata&page=San%20Francisco

That's interesting. so if we update the logic for edit notices (in MediaWiki Core), that should propagate into VisuelEditor correct?

That's interesting. so if we update the logic for edit notices (in MediaWiki Core), that should propagate into VisuelEditor correct?

It should, yes. We will obviously need to check this closer to the time. :-)

I've merged this into T197117 and added a task in the description to ensure that VisualEditor works properly.

@Deskana thanks for your help!

I've merged this into T197117 and added a task in the description to ensure that VisualEditor works properly.
@Deskana thanks for your help!

Cool. Happy to help!

Vvjjkkii renamed this task from Update Visual Editor block notice to be page specific to s3aaaaaaaa.Jul 1 2018, 1:04 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
Scott renamed this task from s3aaaaaaaa to Update Visual Editor block notice to be page specific.Jul 1 2018, 4:52 PM
Scott closed this task as Resolved.
Scott lowered the priority of this task from High to Normal.
Scott updated the task description. (Show Details)
Scott added a subscriber: Aklapper.
Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptJul 1 2018, 4:52 PM