Page MenuHomePhabricator

Prevent BetaFeatures from setting preferences for temporary accounts
Closed, ResolvedPublic

Description

Following T335971, it appears the extension is saving preferences for temporary users.
Update the code to treat temporary users like anon users.

Wherever these do something different based on whether a user is anonymous or registered, they may need updating (including comments).

Tests and comments should also be updated.

Notes
To help with searching:

In PHP preferences are saved via UserOptionsManager::saveOptions
In JS preferences are saved via methods defined on options.js: https://gerrit.wikimedia.org/g/mediawiki/core/+/809d4c9a9dd2cff6321cdae7a41e75b6c362cbbd/resources/src/mediawiki.api/options.js

Event Timeline

(Please add codebase project tags to tasks when possible, so such tasks can be found when looking for open tasks related to that codebase - thanks!)

Change 926308 had a related patch set uploaded (by TsepoThoabala; author: TsepoThoabala):

[mediawiki/extensions/BetaFeatures@master] Prevent BetaFeatures from setting preferences for temporary accounts

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

It looks like the only way to access BetaFeatures is from preferences(Special:Preferences#mw-prefsection-betafeatures)
And to get there, a named user is required as showed here

$this->requireNamedUser( 'prefsnologintext2' );

We should also update this block to use isNamed() incase we get here from other places, and to keep consistency with current code

if ( !$user->isRegistered() ) {
			// Anonymous users do not have options, shorten out.
			return;
	}

Change 926308 merged by jenkins-bot:

[mediawiki/extensions/BetaFeatures@master] Prevent BetaFeatures from setting preferences for temporary accounts

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