54 parent::checkCanExecute( $user );
65 'vertical-label' =>
true,
67 'default' => $this->
msg(
'confirm-watch-top' )->parse()
79 $msgKey = $this->
getTitle()->isTalkPage() ?
'addedwatchtext-talk' :
'addedwatchtext';
104 return Status::newGood();
121 $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
122 if ( $checkRights && !$permissionManager->userHasRight( $user,
'editmywatchlist' ) ) {
128 $status = Status::newFatal(
'hookaborted' );
129 if ( Hooks::run(
'WatchArticle', [ &$user, &
$page, &$status ] ) ) {
130 $status = Status::newGood();
132 Hooks::run(
'WatchArticleComplete', [ &$user, &
$page ] );
146 if ( !MediaWikiServices::getInstance()
148 ->userHasRight( $user,
'editmywatchlist' ) ) {
154 $status = Status::newFatal(
'hookaborted' );
155 if ( Hooks::run(
'UnwatchArticle', [ &$user, &
$page, &$status ] ) ) {
156 $status = Status::newGood();
158 Hooks::run(
'UnwatchArticleComplete', [ &$user, &
$page ] );
174 if ( $action !=
'unwatch' ) {
$page
Page on which we're performing the action.
getTitle()
Shortcut to get the Title object from the page.
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User being used for this instance.
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
Represents a title within MediaWiki.
Redirect a user to the login page.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
addWatch( $title, $checkRights=self::CHECK_USER_RIGHTS)
Watch an article.
getEditToken( $salt='', $request=null)
Initialize (if necessary) and return a session token value which can be used in edit forms to show th...
isWatched( $title, $checkRights=self::CHECK_USER_RIGHTS)
Check the watched status of an article.
removeWatch( $title, $checkRights=self::CHECK_USER_RIGHTS)
Stop watching an article.
isLoggedIn()
Get whether the user is logged in.
static newFatalPermissionDeniedStatus( $permission)
Factory function for fatal permission-denied errors.
isAnon()
Get whether the user is anonymous.
Page addition to a user's watchlist.
getDescription()
Returns the description that goes below the <h1> tag.
static doWatch(Title $title, User $user, $checkRights=User::CHECK_USER_RIGHTS)
Watch a page.
requiresUnblock()
Whether this action can still be executed by a blocked user.
static doWatchOrUnwatch( $watch, Title $title, User $user)
Watch or unwatch a page.
getFormFields()
Get an HTMLForm descriptor array.
static doUnwatch(Title $title, User $user)
Unwatch a page.
usesOOUI()
Whether the form should use OOUI.
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
static getWatchToken(Title $title, User $user, $action='watch')
Get token to watch (or unwatch) a page for a user.
checkCanExecute(User $user)
Checks if the given user (identified by an object) can perform this action.
doesWrites()
Indicates whether this action may perform database writes.
onSuccess()
Do something exciting on successful processing of the form.
onSubmit( $data)
Process the form on POST submission.
getName()
Return the name of the action this object responds to.