Page MenuHomePhabricator

wgIsPageEditable is a lie
Closed, ResolvedPublic


It seems sometimes mw.config.get( 'wgIsPageEditable' ) is set to true on pages that cannot be edited.

For example on wikipedia desktop main page I see a view source button but on I see an edit button.

Version: unspecified
Severity: normal
See Also:



Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 1:57 AM
bzimport set Reference to bz49277.

It's just:

$vars['wgIsPageEditable'] = $user->isAllowed( 'edit' ) && $title->getNamespace() == NS_MAIN

It doesn't take protection into account at all, let alone other things (like cascading protection). At the very least, it should use quickUserCan. See bug 43790 and for discussion of adding a proper version of this to core.

It also excludes non-mainspace, but I assume that's intentional (really not "is it editable?", though, but "is mobile ready to edit it?").

Correct. It currently means can mobile edit but yeh looks like quickCanUserEdit is the way to go! Thanks :)

Related URL: (Gerrit Change Ic924e810b34276312790a41b5455909737cc2082) (Gerrit Change Ic924e810b34276312790a41b5455909737cc2082) | change APPROVED and MERGED [by jenkins-bot]