Page MenuHomePhabricator

wgIsPageEditable is a lie
Closed, ResolvedPublic

Description

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 https://en.m.wikipedia.org/wiki/Main_Page I see an edit button.


Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=43790

Details

Reference
bz49277

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 https://gerrit.wikimedia.org/r/#/c/65009/ 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: https://gerrit.wikimedia.org/r/68483 (Gerrit Change Ic924e810b34276312790a41b5455909737cc2082)

https://gerrit.wikimedia.org/r/68483 (Gerrit Change Ic924e810b34276312790a41b5455909737cc2082) | change APPROVED and MERGED [by jenkins-bot]