diff --git a/includes/EditCheck/ResourceLoaderData.php b/includes/EditCheck/ResourceLoaderData.php index 14b9b34a35..0b7bbc5a50 100644 --- a/includes/EditCheck/ResourceLoaderData.php +++ b/includes/EditCheck/ResourceLoaderData.php @@ -19,8 +19,7 @@ class ResourceLoaderData { // TODO: when we have multiple edit checks this will likely be a generic block: // account: loggedin, loggedout, anything non-truthy means allow either 'account' => false, - // experience: [ comparison, number ], compared to wgUserEditCount - 'experience' => [ '<', 100 ], + 'maximumEditcount' => 100 ], ]; diff --git a/modules/editcheck/init.js b/modules/editcheck/init.js index 7a42f96faa..3e4cc6c214 100644 --- a/modules/editcheck/init.js +++ b/modules/editcheck/init.js @@ -5,23 +5,6 @@ mw.editcheck = {}; mw.editcheck.config = require( './config.json' ); -var compares = function ( matcher, number ) { - // config is an array of [ comparison, value ] - try { - switch ( matcher[ 0 ] ) { - case '<': return number < matcher[ 1 ]; - case '<=': return number <= matcher[ 1 ]; - case '>': return number > matcher[ 1 ]; - case '>=': return number >= matcher[ 1 ]; - case '==': return number === matcher[ 1 ]; - case '!=': return number !== matcher[ 1 ]; - default: return false; - } - } catch ( err ) { - // In case something uncomparable was given as the number - return false; - } -}; mw.editcheck.accountShouldSeeEditCheck = function ( config ) { // account status: // loggedin, loggedout, or any-other-value meaning 'both' @@ -32,7 +15,7 @@ mw.editcheck.accountShouldSeeEditCheck = function ( config ) { if ( config.account === 'loggedin' && !mw.user.isNamed() ) { return false; } - if ( config.experience && !compares( config.experience, mw.config.get( 'wgUserEditCount', 0 ) ) ) { + if ( config.maximumEditcount && mw.config.get( 'wgUserEditCount', 0 ) > config.maximumEditcount ) { return false; } return true;