Edit check: let ecenable bypass the account age requirement

Clean up accountShouldSeeEditCheck since nothing is calling it but the
new method inside BaseEditCheck

Follow-up to e947e53f98

Change-Id: Ic55187bb77f5ef003369313b76a65897fb3be392
This commit is contained in:
David Lynch 2024-09-09 10:50:11 -05:00
parent b19679e381
commit 709e791acd
2 changed files with 10 additions and 18 deletions

View file

@ -62,8 +62,16 @@ mw.editcheck.BaseEditCheck.prototype.canBeShown = function () {
return false; return false;
} }
// some checks are configured to only be for logged in / out users // some checks are configured to only be for logged in / out users
if ( !mw.editcheck.accountShouldSeeEditCheck( this.config ) ) { if ( mw.editcheck.ecenable ) {
// includes checking for mw.editcheck.ecenable return true;
}
// account status:
// loggedin, loggedout, or any-other-value meaning 'both'
// we'll count temporary users as "logged out" by using isNamed here
if ( this.config.account === 'loggedout' && mw.user.isNamed() ) {
return false;
}
if ( this.config.account === 'loggedin' && !mw.user.isNamed() ) {
return false; return false;
} }
// some checks are only shown for newer users // some checks are only shown for newer users

View file

@ -10,22 +10,6 @@ require( './EditCheckFactory.js' );
require( './EditCheckAction.js' ); require( './EditCheckAction.js' );
require( './BaseEditCheck.js' ); require( './BaseEditCheck.js' );
mw.editcheck.accountShouldSeeEditCheck = function ( config ) {
if ( mw.editcheck.ecenable ) {
return true;
}
// account status:
// loggedin, loggedout, or any-other-value meaning 'both'
// we'll count temporary users as "logged out" by using isNamed here
if ( config.account === 'loggedout' && mw.user.isNamed() ) {
return false;
}
if ( config.account === 'loggedin' && !mw.user.isNamed() ) {
return false;
}
return true;
};
// TODO: Load these checks behind feature flags // TODO: Load these checks behind feature flags
// require( './ConvertReferenceEditCheck.js' ); // require( './ConvertReferenceEditCheck.js' );
// require( './TextMatchEditCheck.js' ); // require( './TextMatchEditCheck.js' );