Page MenuHomePhabricator

[BUG] Drawer does not appear for block messages on mobile
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

The drawer which normally appears at the bottom of the screen (screenshot) when attempting to edit a page you are blocked from no longer appears.

It appears to start happening after this change: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/MobileFrontend/+/482385, part of task T149909.

It occurs on beta (1.34.0-alpha (6aacbeb)) and test (1.34.0-wmf.14 (rMW33d36902714e)).

When attempting to edit a page you are blocked from, I don't see any likely errors or warnings in the javascript console.

I see an API request like: api.php?action=query&format=json&formatversion=2&prop=revisions%7Cinfo&rvprop=content%7Ctimestamp&titles=$article&intestactions=edit&intestactionsdetail=full&rvsection=0, which returns a JSON string like: P8782.

Steps to reproduce problem
  1. Use Special:Block to block $user
  2. Login as $user
  3. At the bottom of the page, click "Mobile view"
  4. Go to an article you are blocked from and click the pen icon to attempt to edit

Expected behavior: Drawer appears with the block details (as in screenshot)
Observed behavior: Page reloads, but nothing appears to happen

Screenshots (if applicable):

mobile_block_drawer.png (693×1 px, 33 KB)

Developer notes

Can be replicated with

diff --git a/src/mobile.editor.overlay/EditorGateway.js b/src/mobile.editor.overlay/EditorGateway.js
index 034e6eca4..562b57867 100644
--- a/src/mobile.editor.overlay/EditorGateway.js
+++ b/src/mobile.editor.overlay/EditorGateway.js
@@ -95,14 +95,17 @@ EditorGateway.prototype = {
 			if ( util.isNumeric( this.sectionId ) ) {
 				options.rvsection = this.sectionId;
 			}
-			return this.api.get( options ).then( function ( resp ) {
+			return $.Deferred().resolve( {"batchcomplete":true,"warnings":{"main":{"warnings":"Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes. Use [[Special:ApiFeatureUsage]] to see usage of deprecated features by your application."},"revisions":{"warnings":"Because \"rvslots\" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used."}},"query":{"pages":[{"pageid":49877,"ns":0,"title":"Spam","revisions":[{"timestamp":"2009-06-20T12:07:26Z","contentformat":"text/x-wiki","contentmodel":"wikitext","content":"Hello, World! (Bot test; should be reverted in about one minute)"}],"contentmodel":"wikitext","pagelanguage":"en","pagelanguagehtmlcode":"en","pagelanguagedir":"ltr","touched":"2012-11-02T18:54:26Z","lastrevid":75276,"length":64,"new":true,"actions":{"edit":[{"code":"blocked","text":"You have been blocked from editing.","data":{"blockinfo":{"blockid":18003,"blockedby":"Dom walden","blockedbyid":42287,"blockreason":"","blockedtimestamp":"2019-07-15T08:04:52Z","blockexpiry":"infinite","blockpartial":false}}}]}}]}})
+			.then( function ( resp ) {
 				var revision, pageObj;
+				console.log('resp', resp.error);
 
 				if ( resp.error ) {
 					return util.Deferred().reject( resp.error.code );
 				}
 
 				pageObj = resp.query.pages[0];
+				console.log('resp', pageObj);
 				// page might not exist and caller might not have known.
 				if ( pageObj.missing !== undefined ) {
 					self.content = '';
@@ -115,6 +118,7 @@ EditorGateway.prototype = {
 				// save content a second time to be able to check for changes
 				self.originalContent = self.content;
 				self.blockinfo = self.getBlockInfo( pageObj );
+				console.log(self.blockinfo);
 
 				return resolve();
 			} );

Event Timeline

Jdrewniak added a subscriber: ovasileva.
Jdlrobson moved this task from Incoming to Needs Prioritization on the Web-Team-Backlog board.
Jdlrobson subscribed.

Pinging VisualEditor and Anti-Harrassment team to let them know this is likely broken. Next step lets' work out what happened.

Change 525338 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/MobileFrontend@master] BlockMessage.postRender needs to call super

https://gerrit.wikimedia.org/r/525338

Fix is pretty straightforward - but need a reviewer + a product owner to prioritise.

Change 525338 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] BlockMessage.postRender needs to call super

https://gerrit.wikimedia.org/r/525338

matmarex subscribed.

I guess I can pull it on our workboard…

@dom_walden: Could you check if the fix is working for you?

@dom_walden: Could you check if the fix is working for you?

The drawer appears for me now on Chromium 73 on https://en.m.wikipedia.beta.wmflabs.org/wiki (version 1.34.0-alpha (65f59d1) 14:51, 27 July 2019).

The only thing I notice is that the order of "Details" and "OK" are incorrect (compared to how they were previously). If you like, I can just raise a separate bug for this.

Thanks!

mobile_block_drawer_retest.png (378×534 px, 22 KB)

Change 526004 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/MobileFrontend@master] BlockMessage: Fix order of buttons

https://gerrit.wikimedia.org/r/526004

The only thing I notice is that the order of "Details" and "OK" are incorrect (compared to how they were previously). If you like, I can just raise a separate bug for this.

Please. :)

Change 526004 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] BlockMessage: Fix order of buttons

https://gerrit.wikimedia.org/r/526004

The only thing I notice is that the order of "Details" and "OK" are incorrect (compared to how they were previously). If you like, I can just raise a separate bug for this.

Please. :)

Actually, I guess it is not necessary as the latest patch has just fixed it :).

Change 526004 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] BlockMessage: Fix order of buttons

https://gerrit.wikimedia.org/r/526004

ppelberg claimed this task.