Page MenuHomePhabricator

Don't prompt to use VisualEditor when attempting to edit a protected page
Closed, DuplicatePublic

Description

Steps to reproduce:

  1. While logged out, go to edit a protected page and click on "View source" or go to action=edit via a direct link, such as https://en.wikipedia.org/w/index.php?title=Test&action=edit
  2. You are prompted on whether to use VisualEditor or wikitext. I think this is the main issue – the option to use VisualEditor shouldn't even be there if they are unable to edit, or at least we shouldn't lead them to believe they'll be able to edit.
  3. Click on "Switch to VisualEditor"
  4. From here it seems you are able to edit, which is adverse because one might spend considerable time on an edit that won't go through. This would be prevented with #2 above.
  5. Makes some changes an attempt to save them.
  6. You will receive the error: "Something went wrong": [(random hash)] Exception caught: Invalid code "404". The random hash was WGyVnQpAEDMAAa7HZiQAAACD when I attempted, but changes on every attempt.

So the problem here is VisualEditor is intercepting the edit request workflow. A prime example: As an experienced user trying to help a newbie, you may give them the direct edit link so they will be able to click the "Submit an edit request" button. I don't think there's any reason to load the VisualEditor app at that point, just show MediaWiki:Protectedpagetext.

Turning this bug into a solution for making edit requests
Submitting an edit request as a newbie has never been easy. At least on enwiki, we ask for the request to be in the form of "turn A into B", which they rarely do. So what if we allowed them to make an edit request through VisualEditor? Imagine in the above step #2, it instead showed the message "You can submit an edit request manually or use VisualEditor to request your changes". Then in step #4, they make the changes they'd like to propose, and hit "Submit edit request" (shown instead of "Save") and bam, we have the removed and added lines of the edit which can be supplied to the edit request template. I will safely assume this "edit request" process varies wiki to wiki, so maybe this really cool idea won't work. But it's still really cool, and I thought I'd bring it up :)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 4 2017, 6:52 AM
MusikAnimal triaged this task as Medium priority.Jan 4 2017, 6:53 AM
MusikAnimal updated the task description. (Show Details)

Changing the priority to Normal (tempted to make it High) in regards to the bug itself. Allowing users to get to step #4, where in a worst case scenario, they spend a lot of time doing research, adding content, etc., then not being able to save, is not so good :(

MusikAnimal renamed this task from VisualEditor: Bug when attempting to edit a protected page to Bug when attempting to edit a protected page.Jan 4 2017, 6:59 AM
MusikAnimal renamed this task from Bug when attempting to edit a protected page to Don't prompt to use VisualEditor when attempting to edit a protected page.
Krenair added a subscriber: Krenair.EditedJan 4 2017, 2:27 PM

The exception referenced was this:

archive/exception.log-20170104:2017-01-04 06:26:37 [WGyVnQpAEDMAAa7HZiQAAACD] mw1286 enwiki 1.29.0-wmf.6 exception ERROR: [WGyVnQpAEDMAAa7HZiQAAACD] /w/api.php   InvalidArgumentException from line 159 of /srv/mediawiki/php-1.29.0-wmf.6/includes/api/ApiMessage.php: Invalid code "404" {"exception_id":"WGyVnQpAEDMAAa7HZiQAAACD"} 
archive/exception.log-20170104:[Exception InvalidArgumentException] (/srv/mediawiki/php-1.29.0-wmf.6/includes/api/ApiMessage.php:159) Invalid code "404"
archive/exception.log-20170104:  #0 /srv/mediawiki/php-1.29.0-wmf.6/includes/api/ApiMessage.php(258): ApiMessage->setApiCode(integer, NULL)
archive/exception.log-20170104:  #1 /srv/mediawiki/php-1.29.0-wmf.6/includes/api/ApiMessage.php(233): ApiMessage->__construct(array, integer, NULL)
archive/exception.log-20170104:  #2 /srv/mediawiki/php-1.29.0-wmf.6/includes/api/ApiUsageException.php(143): ApiMessage::create(array, integer, NULL)
archive/exception.log-20170104:  #3 /srv/mediawiki/php-1.29.0-wmf.6/includes/api/ApiBase.php(1734): ApiUsageException::newWithMessage(ApiVisualEditorEdit, array, integer, NULL, NULL)
archive/exception.log-20170104:  #4 /srv/mediawiki/php-1.29.0-wmf.6/extensions/VisualEditor/ApiVisualEditor.php(120): ApiBase->dieWithError(array, integer)
archive/exception.log-20170104:  #5 /srv/mediawiki/php-1.29.0-wmf.6/extensions/VisualEditor/ApiVisualEditorEdit.php(196): ApiVisualEditor->requestRestbase(string, string, array, array)
archive/exception.log-20170104:  #6 /srv/mediawiki/php-1.29.0-wmf.6/extensions/VisualEditor/ApiVisualEditorEdit.php(203): ApiVisualEditorEdit->postData(string, Title, array, array, string)
archive/exception.log-20170104:  #7 /srv/mediawiki/php-1.29.0-wmf.6/extensions/VisualEditor/ApiVisualEditorEdit.php(145): ApiVisualEditorEdit->postHTML(Title, string, array, string)
archive/exception.log-20170104:  #8 /srv/mediawiki/php-1.29.0-wmf.6/extensions/VisualEditor/ApiVisualEditorEdit.php(136): ApiVisualEditorEdit->getWikitextNoCache(Title, array, array)
archive/exception.log-20170104:  #9 /srv/mediawiki/php-1.29.0-wmf.6/extensions/VisualEditor/ApiVisualEditorEdit.php(266): ApiVisualEditorEdit->getWikitext(Title, array, array)
archive/exception.log-20170104:  #10 /srv/mediawiki/php-1.29.0-wmf.6/includes/api/ApiMain.php(1532): ApiVisualEditorEdit->execute()
archive/exception.log-20170104:  #11 /srv/mediawiki/php-1.29.0-wmf.6/includes/api/ApiMain.php(541): ApiMain->executeAction()
archive/exception.log-20170104:  #12 /srv/mediawiki/php-1.29.0-wmf.6/includes/api/ApiMain.php(512): ApiMain->executeActionWithErrorHandling()
archive/exception.log-20170104:  #13 /srv/mediawiki/php-1.29.0-wmf.6/api.php(83): ApiMain->execute()
archive/exception.log-20170104:  #14 /srv/mediawiki/w/api.php(3): include(string)
archive/exception.log-20170104:  #15 {main}

https://gerrit.wikimedia.org/r/#/c/327718/ changed this from an exception into an unuseful message displayed to the user (and hasn't been deployed to enwiki yet)

Edit: https://gerrit.wikimedia.org/r/330419 should improve that a bit