Page MenuHomePhabricator

SubmissionHandler should expose real error messages, rather than coercing everything to "user is blocked"
Closed, ResolvedPublic

Description

From T118567#1809438:

SubmissionHandler::handleSubmit() contains the following code:

// Check mediawiki core permissions for title protection, blocked
// status, etc.
if ( !$workflow->userCan( 'edit', $context->getUser() ) ) {
	reset( $interestedBlocks )->addError( 'block', wfMessage( 'blockedtitle' ) );
	return array();
}

This means that if there was any sort of error whatsoever, the reported error will be "user is blocked" even though the actual error might be something very different.

In MW core, Title::userCan() is really just a wrapper for Title::getUserPermissionsErrors(), so we should be able to surface the real error.

Event Timeline

Catrope created this task.Nov 17 2015, 6:57 PM
Catrope assigned this task to SBisson.
Catrope raised the priority of this task from to High.
Catrope updated the task description. (Show Details)
Catrope added subscribers: Antigng, Trizek-WMF, Cosine02 and 5 others.

Change 253752 had a related patch set uploaded (by Sbisson):
Surface permission errors

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

Change 253752 merged by jenkins-bot:
Surface permission errors

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

Change 254074 had a related patch set uploaded (by Catrope):
Surface permission errors

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

Change 254074 merged by jenkins-bot:
Surface permission errors

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

At some point, it'd be great to review all error messages so they provide unambiguous feedback to users.

Catrope closed this task as Resolved.Nov 22 2015, 10:08 PM
Liuxinyu970226 removed a subscriber: Liuxinyu970226.