Merge "Use user IDs, not User objects, for reverted-user-id"

This commit is contained in:
jenkins-bot 2020-07-28 12:11:24 +00:00 committed by Gerrit Code Review
commit d8d0e52c03

View file

@ -622,13 +622,14 @@ class EchoHooks implements RecentChange_saveHook {
Title::newFromLinkTarget( $undidRevision->getPageAsLinkTarget() )->equals( $title )
) {
$revertedUser = $undidRevision->getUser();
if ( $revertedUser ) { // No notifications for anonymous users
// No notifications for anonymous users
if ( $revertedUser && $revertedUser->getId() ) {
EchoEvent::create( [
'type' => 'reverted',
'title' => $title,
'extra' => [
'revid' => $revisionRecord->getId(),
'reverted-user-id' => $revertedUser,
'reverted-user-id' => $revertedUser->getId(),
'reverted-revision-id' => $undidRevId,
'method' => 'undo',
'summary' => $summary,
@ -1291,7 +1292,8 @@ class EchoHooks implements RecentChange_saveHook {
self::$lastRevertedRevision = $latestRevision;
if (
$revertedUser && // No notifications for anonymous users
$revertedUser &&
$revertedUser->getId() && // No notifications for anonymous users
!$oldRevision->hasSameContent( $newRevision ) // No notifications for null rollbacks
) {
EchoEvent::create( [
@ -1299,7 +1301,7 @@ class EchoHooks implements RecentChange_saveHook {
'title' => $wikiPage->getTitle(),
'extra' => [
'revid' => $latestRevision->getId(),
'reverted-user-id' => $revertedUser,
'reverted-user-id' => $revertedUser->getId(),
'reverted-revision-id' => $oldRevision->getId(),
'method' => 'rollback',
],