Replace RecentChange::getPerformer with RecentChange::getPerformerIdentity

Refactor $actor as UserIdentity
Refactor Event::getAgent() to return UserIdentity

Bug: T276412
Change-Id: Ieb0dbacd2dcab7700b83fb090587b4957c8128c9
This commit is contained in:
Vadim Kovalenko 2021-03-09 13:29:11 -05:00 committed by Roman Stolar
parent f6d71ce1a9
commit 3e65888791
3 changed files with 6 additions and 3 deletions

View file

@ -1673,6 +1673,7 @@ class EchoHooks implements RecentChange_saveHook {
} else {
$type = 'watchlist-change';
}
$user = User::newFromIdentity( $change->getPerformerIdentity() );
EchoEvent::create( [
'type' => $type,
'title' => $change->getTitle(),
@ -1682,7 +1683,7 @@ class EchoHooks implements RecentChange_saveHook {
'status' => $change->mExtra["pageStatus"],
'timestamp' => $change->getAttribute( "rc_timestamp" )
],
'agent' => $change->getPerformer()
'agent' => $user
] );
}

View file

@ -462,7 +462,8 @@ class EchoEvent extends EchoAbstractEntity implements Bundleable {
} else {
// Use User::isHidden()
$permManager = MediaWikiServices::getInstance()->getPermissionManager();
return $permManager->userHasAnyRight( $user, 'viewsuppressed', 'hideuser' ) || !$agent->isHidden();
return $permManager->userHasAnyRight( $user, 'viewsuppressed', 'hideuser' )
|| !$agent->isHidden();
}
} elseif ( $revision ) {
// A revision is set, use rev_deleted

View file

@ -246,7 +246,7 @@ class GenerateSampleNotifications extends Maintenance {
$this->output( "{$agent->getName()} is mentioning {$user->getName()} on {$title->getTalkPage()->getPrefixedText()}\n" );
$this->addToPageContent( $title->getTalkPage(), $agent, $mention );
// agent tak
// agent talk
$this->output( "{$agent->getName()} is mentioning {$user->getName()} on {$agent->getTalkPage()->getPrefixedText()}\n" );
$this->addToPageContent( $agent->getTalkPage(), $agent, $mention );
@ -299,6 +299,7 @@ class GenerateSampleNotifications extends Maintenance {
);
$status = $page->doEditContent( $content, 'undo', 0, false, $agent, null, [], $undoRev->getId() );
if ( !$status->isGood() ) {
$this->error( "Failed to undo {$moai->getPrefixedText()}: {$status->getMessage()->text()}" );
}