Page MenuHomePhabricator

3rd parties: Edit button shows as enabled to anonymous editors.
Closed, ResolvedPublic

Description

If I use the MinervaNeue skin for the MobileFrontend extension and I set the following user rights in MediaWiki via the wgGroupPermissions preference in the LocalSettings.php file:

$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['user']['edit'] = true;

Expected:
As the setting above defines that anonymous users who are not logged in cannot edit a wiki page, I should get some indication I cannot edit.

Actual:
the edit button can still be clicked and I see this

Screen Shot 2018-10-11 at 4.06.13 PM.png (437×671 px, 50 KB)

I can continue the edit and its only when I try to save that I hit issues.

Expected: Clicking the edit icon should prompt the user to login in some way.

acceptance criteria

  • Edit icon must show at locked for these users
  • When clicking the edit icon we should show the CtaDrawer just as we do for the watchstar.
  • The messaging of the drawer should use mobile-frontend-edit-login-action

Developer notes

At minimum, we should disable the edit icon to these users (showing edit-locked) based on the check of permissions.

A better solution would be to mimic the CtaDrawer for the watchstar.
The CtaDrawer provides this functionality for the watchstar.

Screen Shot 2018-10-11 at 4.07.20 PM.png (772×681 px, 172 KB)

Related: T206813

QA steps

Please verify the edit pencil is performing as expected on both beta cluster and reading web staging.
The 3rd party use case has been tested and verified by @Jdlrobson so no need to check that!

Event Timeline

Cannot reproduce, it shows "This page is protected" for me when I'm trying to edit it from anonymous account.

EDIT: can reproduce if the page isn't refreshed after the settings change but I don't think it's not expected behaviour.

Hey @Bjornskjald ! that part of this bug does look fixed to me! Thanks for checking!

However, the message "This page is protected to prevent vandalism." is a little misleading. Ideally, instead of showing that notification message we'd prompt the user to login like so under these circumstances:

Screen Shot 2018-10-11 at 4.07.20 PM.png (772×681 px, 172 KB)

You can use mw.config.get('wgRestrictionEdit') to check:

if ( mw.user.isAnon() && mw.config.get('wgRestrictionEdit').indexOf( '*' ) ) {
//show login prompt
} else {
//show permission error
}
Jdlrobson updated the task description. (Show Details)

Thanks for looking at this one. I'm moving it to a workboard where I can keep track on this task to help answer any further questions and help review this! Good luck!

By the way, is it an issue in MobileFrontend? Because I couldn't find that string anywhere in the repo

EDIT: nevermind, it's in MinervaNeue.

Change 471302 had a related patch set uploaded (by Bjornskjald; owner: Bjornskjald):
[mediawiki/skins/MinervaNeue@master] Add drawer when user is not logged in and anonymous edits are disabled

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

Change 471302 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Add drawer when user is not logged in and anonymous edits are disabled

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

Looks good to me on Beta cluster and staging, but it does look a bit different between the two sites. For example, in the images below, the edit icon (upper right) is displayed on beta and does not appear on staging. @ovasileva or @Jdlrobson, is this ok?

image.png (960×540 px, 139 KB)

image.png (1×500 px, 243 KB)

image.png (1×720 px, 147 KB)

Jdlrobson added a subscriber: Ryasmeen.

Reading web staging was outdated. I've updated it now. Given beta cluster was fine, and beta cluster is more up to date, I think we're done here!

Looks good, thanks all