Merge "Fix parameter order of setWatch to match add/removeWatch"
This commit is contained in:
commit
5a45bb712a
10 changed files with 23 additions and 23 deletions
|
|
@ -2528,7 +2528,7 @@ class EditPage implements IEditObject {
|
|||
// This can't run as a DeferredUpdate due to a possible race condition
|
||||
// when the post-edit redirect happens if the pendingUpdates queue is
|
||||
// too large to finish in time (T259564)
|
||||
$this->watchlistManager->setWatch( $watch, $title, $performer, $watchlistExpiry );
|
||||
$this->watchlistManager->setWatch( $watch, $performer, $title, $watchlistExpiry );
|
||||
|
||||
$this->watchedItemStore->maybeEnqueueWatchlistExpiryJob();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,8 +146,8 @@ class FileDeleteForm {
|
|||
|
||||
MediaWikiServices::getInstance()->getWatchlistManager()->setWatch(
|
||||
$request->getCheck( 'wpWatch' ),
|
||||
$this->title,
|
||||
$this->user
|
||||
$this->user,
|
||||
$this->title
|
||||
);
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -395,8 +395,8 @@ class ProtectionForm {
|
|||
|
||||
$this->watchlistManager->setWatch(
|
||||
$this->mRequest->getCheck( 'mwProtectWatch' ),
|
||||
$this->mTitle,
|
||||
$this->mUser
|
||||
$this->mUser,
|
||||
$this->mTitle
|
||||
);
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -77,8 +77,8 @@ class WatchAction extends FormAction {
|
|||
// changed expiry.
|
||||
return MediaWikiServices::getInstance()->getWatchlistManager()->setWatch(
|
||||
true,
|
||||
$this->getTitle(),
|
||||
$this->getContext()->getAuthority(),
|
||||
$this->getTitle(),
|
||||
$expiry
|
||||
);
|
||||
}
|
||||
|
|
@ -257,8 +257,8 @@ class WatchAction extends FormAction {
|
|||
) {
|
||||
return Status::wrap( MediaWikiServices::getInstance()->getWatchlistManager()->setWatch(
|
||||
$watch,
|
||||
$pageIdentity,
|
||||
$performer,
|
||||
$pageIdentity,
|
||||
$expiry
|
||||
) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ trait ApiWatchlistTrait {
|
|||
): void {
|
||||
$value = $this->getWatchlistValue( $watch, $title, $user, $userOption );
|
||||
MediaWikiServices::getInstance()->getWatchlistManager()
|
||||
->setWatch( $value, $title, $user, $expiry );
|
||||
->setWatch( $value, $user, $title, $expiry );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1916,7 +1916,7 @@ class Article implements Page {
|
|||
|
||||
$this->doDelete( $reason, $suppress );
|
||||
|
||||
$this->watchlistManager->setWatch( $request->getCheck( 'wpWatch' ), $title, $context->getAuthority() );
|
||||
$this->watchlistManager->setWatch( $request->getCheck( 'wpWatch' ), $context->getAuthority(), $title );
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -903,8 +903,8 @@ class MovePageForm extends UnlistedSpecialPage {
|
|||
}
|
||||
|
||||
# Deal with watches (we don't watch subpages)
|
||||
$this->watchlistManager->setWatch( $this->watch, $ot, $this->getAuthority() );
|
||||
$this->watchlistManager->setWatch( $this->watch, $nt, $this->getAuthority() );
|
||||
$this->watchlistManager->setWatch( $this->watch, $this->getAuthority(), $ot );
|
||||
$this->watchlistManager->setWatch( $this->watch, $this->getAuthority(), $nt );
|
||||
}
|
||||
|
||||
private function showLogFragment( $title ) {
|
||||
|
|
|
|||
|
|
@ -518,8 +518,8 @@ class WatchlistManager {
|
|||
* state and if the expiry is the same so it does not act unnecessarily.
|
||||
*
|
||||
* @param bool $watch Whether to watch or unwatch the page
|
||||
* @param PageIdentity $pageIdentity Page to watch/unwatch
|
||||
* @param Authority $performer who is watching/unwatching
|
||||
* @param PageIdentity $target Page to watch/unwatch
|
||||
* @param string|null $expiry Optional expiry timestamp in any format acceptable to wfTimestamp(),
|
||||
* null will not create expiries, or leave them unchanged should they already exist.
|
||||
* @return StatusValue
|
||||
|
|
@ -527,8 +527,8 @@ class WatchlistManager {
|
|||
*/
|
||||
public function setWatch(
|
||||
bool $watch,
|
||||
PageIdentity $pageIdentity,
|
||||
Authority $performer,
|
||||
PageIdentity $target,
|
||||
string $expiry = null
|
||||
) : StatusValue {
|
||||
// User must be registered, and either changing the watch state or at least the expiry.
|
||||
|
|
@ -537,7 +537,7 @@ class WatchlistManager {
|
|||
}
|
||||
|
||||
// Only call addWatchhIgnoringRights() or removeWatch() if there's been a change in the watched status.
|
||||
$link = TitleValue::newFromPage( $pageIdentity );
|
||||
$link = TitleValue::newFromPage( $target );
|
||||
$oldWatchedItem = $this->watchedItemStore->getWatchedItem( $performer->getUser(), $link );
|
||||
$changingWatchStatus = (bool)$oldWatchedItem !== $watch;
|
||||
if ( $oldWatchedItem && $expiry !== null ) {
|
||||
|
|
@ -553,9 +553,9 @@ class WatchlistManager {
|
|||
// If the user doesn't have 'editmywatchlist', we still want to
|
||||
// allow them to add but not remove items via edits and such.
|
||||
if ( $watch ) {
|
||||
return $this->addWatchIgnoringRights( $performer->getUser(), $pageIdentity, $expiry );
|
||||
return $this->addWatchIgnoringRights( $performer->getUser(), $target, $expiry );
|
||||
} else {
|
||||
return $this->removeWatch( $performer, $pageIdentity );
|
||||
return $this->removeWatch( $performer, $target );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -925,7 +925,7 @@ hello
|
|||
$article->setContext( $context );
|
||||
$ep = new EditPage( $article );
|
||||
$this->getServiceContainer()->getWatchlistManager()
|
||||
->setWatch( (bool)$existingExpiry, $title, $user, $existingExpiry );
|
||||
->setWatch( (bool)$existingExpiry, $user, $title, $existingExpiry );
|
||||
|
||||
// Send the request.
|
||||
$req = new FauxRequest( [ 'wpWatchlistExpiry' => $postVal ], true );
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ class WatchlistManagerTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$watchlistManager->addWatchIgnoringRights( $userIdentity, $title );
|
||||
|
||||
$status = $watchlistManager->setWatch( true, $title, $performer, '1 week' );
|
||||
$status = $watchlistManager->setWatch( true, $performer, $title, '1 week' );
|
||||
|
||||
$this->assertTrue( $status->isGood() );
|
||||
$this->assertTrue( $watchlistManager->isWatchedIgnoringRights( $userIdentity, $title ) );
|
||||
|
|
@ -235,7 +235,7 @@ class WatchlistManagerTest extends MediaWikiIntegrationTestCase {
|
|||
$services = $this->getServiceContainer();
|
||||
$watchlistManager = $services->getWatchlistManager();
|
||||
|
||||
$status = $watchlistManager->setWatch( true, $title, $performer );
|
||||
$status = $watchlistManager->setWatch( true, $performer, $title );
|
||||
|
||||
// returns immediately with no error if not logged in
|
||||
$this->assertTrue( $status->isGood() );
|
||||
|
|
@ -261,7 +261,7 @@ class WatchlistManagerTest extends MediaWikiIntegrationTestCase {
|
|||
$watchlistManager->addWatchIgnoringRights( $userIdentity, $title, $expiry );
|
||||
|
||||
// Same expiry
|
||||
$status = $watchlistManager->setWatch( true, $title, $performer, $expiry );
|
||||
$status = $watchlistManager->setWatch( true, $performer, $title, $expiry );
|
||||
|
||||
$this->assertTrue( $status->isGood() );
|
||||
}
|
||||
|
|
@ -282,7 +282,7 @@ class WatchlistManagerTest extends MediaWikiIntegrationTestCase {
|
|||
$services = $this->getServiceContainer();
|
||||
$watchlistManager = $services->getWatchlistManager();
|
||||
|
||||
$status = $watchlistManager->setWatch( false, $title, $performer );
|
||||
$status = $watchlistManager->setWatch( false, $performer, $title );
|
||||
|
||||
$this->assertTrue( $status->isGood() );
|
||||
}
|
||||
|
|
@ -301,7 +301,7 @@ class WatchlistManagerTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$watchlistManager->addWatchIgnoringRights( $userIdentity, $title );
|
||||
|
||||
$status = $watchlistManager->setWatch( true, $title, $performer );
|
||||
$status = $watchlistManager->setWatch( true, $performer, $title );
|
||||
|
||||
$this->assertTrue( $status->isGood() );
|
||||
$this->assertTrue( $watchlistManager->isWatchedIgnoringRights( $userIdentity, $title ) );
|
||||
|
|
@ -322,7 +322,7 @@ class WatchlistManagerTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
$watchedItemStore->clearUserWatchedItems( $userIdentity );
|
||||
|
||||
$status = $watchlistManager->setWatch( false, $title, $performer );
|
||||
$status = $watchlistManager->setWatch( false, $performer, $title );
|
||||
|
||||
$this->assertTrue( $status->isGood() );
|
||||
$this->assertFalse( $watchlistManager->isWatchedIgnoringRights( $userIdentity, $title ) );
|
||||
|
|
|
|||
Loading…
Reference in a new issue