Page MenuHomePhabricator

Wikitext editor error handling broken in read only mode
Closed, ResolvedPublic3 Estimated Story Points


A wiki can be made readonly like so:

$wgReadOnly = true;

If the editor has been opened before read only mode has been invoked, and an edit is completed with the mobile source editor, when the save fails, a toast is presented with a generic error message, but the toast is not visible until you scroll down, and the toast appears "underneath" the article content. The error message should probably display the "apierror-readonly" message EditorOverlay.js#L285

Screen Shot 2018-06-04 at 10.14.23.png (835×1 px, 249 KB)

Acceptance criteria

  • Make sure any error is displayed inside the editor itself, above the preview, using errorbox class (note other box styles may be inside mobile.special.styles.
  • Remove code relating to toast error handling.
  • Include and display the apierror-readonly error message when this error occurs


Screen Shot 2018-06-15 at 3.17.17 PM.png (373×1 px, 48 KB)

Developer/designer notes

Code lives inside MobileFrontend.

QA steps

read only mobile

Open the mobile editor.
While open, ask a developer to enable

$wgReadOnly = 'This wiki is currently being upgraded to a newer software version.';
  • Does the read only message show inside the editor when you try to save your edit?

Event Timeline

Jdlrobson triaged this task as Medium priority.Jun 15 2018, 10:19 PM
Jdlrobson created this task.
Jdlrobson added a subscriber: alexhollender_WMF.

@alexhollender which of the solutions looks preferable to you?

@Jdlrobson the red error inside of the editing space looks good 👍

Jdlrobson updated the task description. (Show Details)
Jdlrobson moved this task from Incoming to Triaged but Future on the Readers-Web-Backlog board.
Vvjjkkii renamed this task from Wikitext editor error handling broken in read only mode to 8saaaaaaaa.Jul 1 2018, 1:03 AM
Vvjjkkii raised the priority of this task from Medium to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
CommunityTechBot renamed this task from 8saaaaaaaa to Wikitext editor error handling broken in read only mode.Jul 2 2018, 12:05 PM
CommunityTechBot lowered the priority of this task from High to Medium.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added a subscriber: Aklapper.

Looking like a 3. Confirmation to follow!

Jdlrobson set the point value for this task to 3.Jul 31 2018, 1:59 AM

Change 453131 had a related patch set uploaded (by Jdlrobson; owner: Jdrewniak):
[mediawiki/extensions/MobileFrontend@master] Remove toast-style error messaging from source editor overlay

An update on the treatment.
Admins can supply either a message or a boolean when putting the wiki in readonly mode. I've incorporated this message into the treatment in case it exists.

Screen Shot 2018-08-16 at 18.57.16.png (734×2 px, 127 KB)

Error logging?
I noticed in the code that edit errors appear to be logged to Schema:Edit. I'm assuming errors from readonly mode should also be logged? @Tbayer please confirm.
@Jdlrobson I don't know how mf.schemaEdit is loaded in mobileFrontend. Usual it's defined in extensions.json, but I don't see it there. (If I update the schema, I'll need to bump the version).
...5 minutes later, oh, looks like the schema is being created here with new mw.eventLog.Schema with a version of 1, is that valid?

CCing @Neil_P._Quinn_WMF who is more qualified to speak about the Edit schema.

This has been enabled on staging.
A visit to will open the editor interface. Try to make a save and you will see the error.

The message is rendering correctly. Where does the copy come from? I'm wondering if we can add something to the end like Please check back in a few hours (or whatever time frame would be appropriate) @Jdlrobson @ovasileva

reading-web-staging.wmflabs.org_wiki_Claude_Debussy(iPhone 6_7_8).png (1×750 px, 99 KB)

The error message copy is set by the user turning on read only mode i.e. me in this case so yes please check back etc can be added.$wgReadOnly#Details

Tested on Mac desktop, iOS, and Android. Looks good all around. Moving to signoff.

IMG_0011.PNG (1×750 px, 85 KB)
Screenshot_20180824-133119.png (2×1 px, 189 KB)

Passing to @Jdlrobson for the technical portions of signoff

Jdlrobson updated the task description. (Show Details)