summaryrefslogtreecommitdiff
path: root/includes/api/ApiWatch.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
commit4ac9fa081a7c045f6a9f1cfc529d82423f485b2e (patch)
treeaf68743f2f4a47d13f2b0eb05f5c4aaf86d8ea37 /includes/api/ApiWatch.php
parentaf4da56f1ad4d3ef7b06557bae365da2ea27a897 (diff)
Update to MediaWiki 1.22.0
Diffstat (limited to 'includes/api/ApiWatch.php')
-rw-r--r--includes/api/ApiWatch.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/includes/api/ApiWatch.php b/includes/api/ApiWatch.php
index 3e51299f..c7d636a1 100644
--- a/includes/api/ApiWatch.php
+++ b/includes/api/ApiWatch.php
@@ -36,6 +36,9 @@ class ApiWatch extends ApiBase {
if ( !$user->isLoggedIn() ) {
$this->dieUsage( 'You must be logged-in to have a watchlist', 'notloggedin' );
}
+ if ( !$user->isAllowed( 'editmywatchlist' ) ) {
+ $this->dieUsage( 'You don\'t have permission to edit your watchlist', 'permissiondenied' );
+ }
$params = $this->extractRequestParams();
$title = Title::newFromText( $params['title'] );
@@ -57,19 +60,19 @@ class ApiWatch extends ApiBase {
if ( $params['unwatch'] ) {
$res['unwatched'] = '';
$res['message'] = $this->msg( 'removedwatchtext', $title->getPrefixedText() )->title( $title )->parseAsBlock();
- $success = UnwatchAction::doUnwatch( $title, $user );
+ $status = UnwatchAction::doUnwatch( $title, $user );
} else {
$res['watched'] = '';
$res['message'] = $this->msg( 'addedwatchtext', $title->getPrefixedText() )->title( $title )->parseAsBlock();
- $success = WatchAction::doWatch( $title, $user );
+ $status = WatchAction::doWatch( $title, $user );
}
if ( !is_null( $oldLang ) ) {
$this->getContext()->setLanguage( $oldLang ); // Reset language to $oldLang
}
- if ( !$success ) {
- $this->dieUsageMsg( 'hookaborted' );
+ if ( !$status->isOK() ) {
+ $this->dieStatus( $status );
}
$this->getResult()->addValue( null, $this->getModuleName(), $res );
}