Page MenuHomePhabricator

Improve blocker information on mobile block error message drawer
Closed, ResolvedPublic

Description

The mobile block error message drawer always displays a link to the block creator's user page on the local wiki.

However, this does not always make sense, since the creator is not always a local user. Global blocks may be created by a user who does not exist on the local wiki. System blocks are not created by real users.

In these examples, the link leads to a nonexistent user page, such as:

image.png (321×305 px, 26 KB)

Furthermore, after T227005, system blocks will no longer have fake users as their blockers, so it won't be possible even to link to a page for the fake username.

The mobile error message drawer should be updated to handle the following situations:

  1. The blocker is a local user. Link to their user page.
  2. The blocker is a user, but not a local user (the blocker has ID 0). Display the name but do not link to the nonexistent user page.
  3. There is no blocker (the blocker has ID 0 and name ''). Do not display any blocker information.

Event Timeline

Change 546991 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/extensions/MobileFrontend@master] Allow block message drawer to handle different block creators

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

Proposed appearance for the three different types of block creators:

Blocker typeAppearanceNotes
Local user
image.png (294×330 px, 19 KB)
"Admin" links to User:Admin. Currently all block creators display this way; if creator is not a local user, link points to nonexistent page.
Not a local user, but a name is given for the creator
image.png (339×330 px, 26 KB)
"Global>Admin" is not a link
Software
image.png (366×331 px, 33 KB)
No block creator is listed

Should note that MobileFrontend currently sometimes throws a JS error in parseBlockInfo:

blockInfo = {
	partial: blockinfo.blockpartial || false,
	creator: {
		name: blockinfo.blockedby,
		url: mw.Title.makeTitle(
			mw.config.get( 'wgNamespaceIds' ).user,
			blockinfo.blockedby
		).getUrl()
	},
	expiry: null,
	duration: null,
	reason: '',
	blockId: blockinfo.blockid
};

We can't guarantee that blockinfo.blockedby can be made into a Title object. If it is something like "Global>Admin", then we get: TypeError: Cannot read property 'getUrl' of null. This type of block should be rare though.

Solving this task will fix this.

@Tchanders Thanks for the proposed mocks. I have a clarifying question about the second mock - Not a local user, but a name is given for the creator. Is "Global>Admin" the username of the user who performed the block but because they don't have a local account we can't make it a link?

@Niharika It can be a username but it's not guaranteed to be. In this example, the text was created by CentralAuth, which concatenates some prefix (Global) with the username (Admin), but other extensions can do it differently. We're not in control of the text - it's passed in as a block constructor option.

@Niharika It can be a username but it's not guaranteed to be. In this example, the text was created by CentralAuth, which concatenates some prefix (Global) with the username (Admin), but other extensions can do it differently. We're not in control of the text - it's passed in as a block constructor option.

Ah, okay, I get it. If it's a string passed from elsewhere, I guess we can't do much but trust that they would provide a username or something that is self explanatory.

Change 546991 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Allow block message drawer to handle different block creators

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

dom_walden subscribed.

The mobile error message drawer should be updated to handle the following situations:

  1. The blocker is a local user. Link to their user page.

On Beta, username and IP blocks show correct blocker under "Blocked by" and the link to the blocker's user page is correct.

  1. The blocker is a user, but not a local user (the blocker has ID 0). Display the name but do not link to the nonexistent user page.

On local vagrant, local blocks created by CentralAuth just show "Global>$blocker", but no link to the user page.

  1. There is no blocker (the blocker has ID 0 and name ''). Do not display any blocker information.

Composite and system blocks do not show a "blocked by" section.

System blocks just show "Reason for the block" section.

Only testing the error message on mobile editing, as I believe that is the only place this change touches.