X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fapi%2FApiSetNotificationTimestamp.php;h=5769ff6d3917335ca007988a70b35549203883ac;hp=3412f38ed3c2dc797426f1d36738b6a3a0f60ae2;hb=ce079cf6ad79ca8d3360817f809b219d166f9153;hpb=61898ad28ed69c5b391eb43e0db9386279b9612c diff --git a/includes/api/ApiSetNotificationTimestamp.php b/includes/api/ApiSetNotificationTimestamp.php index 3412f38ed3..5769ff6d39 100644 --- a/includes/api/ApiSetNotificationTimestamp.php +++ b/includes/api/ApiSetNotificationTimestamp.php @@ -38,11 +38,9 @@ class ApiSetNotificationTimestamp extends ApiBase { $user = $this->getUser(); if ( $user->isAnon() ) { - $this->dieUsage( 'Anonymous users cannot use watchlist change notifications', 'notloggedin' ); - } - if ( !$user->isAllowed( 'editmywatchlist' ) ) { - $this->dieUsage( 'You don\'t have permission to edit your watchlist', 'permissiondenied' ); + $this->dieWithError( 'watchlistanontext', 'notloggedin' ); } + $this->checkUserRightsAny( 'editmywatchlist' ); $params = $this->extractRequestParams(); $this->requireMaxOneParameter( $params, 'timestamp', 'torevid', 'newerthanrevid' ); @@ -52,8 +50,12 @@ class ApiSetNotificationTimestamp extends ApiBase { $pageSet = $this->getPageSet(); if ( $params['entirewatchlist'] && $pageSet->getDataSource() !== null ) { - $this->dieUsage( - "Cannot use 'entirewatchlist' at the same time as '{$pageSet->getDataSource()}'", + $this->dieWithError( + [ + 'apierror-invalidparammix-cannotusewith', + $this->encodeParamName( 'entirewatchlist' ), + $pageSet->encodeParamName( $pageSet->getDataSource() ) + ], 'multisource' ); } @@ -71,7 +73,7 @@ class ApiSetNotificationTimestamp extends ApiBase { if ( isset( $params['torevid'] ) ) { if ( $params['entirewatchlist'] || $pageSet->getGoodTitleCount() > 1 ) { - $this->dieUsage( 'torevid may only be used with a single page', 'multpages' ); + $this->dieWithError( [ 'apierror-multpages', $this->encodeParamName( 'torevid' ) ] ); } $title = reset( $pageSet->getGoodTitles() ); if ( $title ) { @@ -85,7 +87,7 @@ class ApiSetNotificationTimestamp extends ApiBase { } } elseif ( isset( $params['newerthanrevid'] ) ) { if ( $params['entirewatchlist'] || $pageSet->getGoodTitleCount() > 1 ) { - $this->dieUsage( 'newerthanrevid may only be used with a single page', 'multpages' ); + $this->dieWithError( [ 'apierror-multpages', $this->encodeParamName( 'newerthanrevid' ) ] ); } $title = reset( $pageSet->getGoodTitles() ); if ( $title ) {