Avoid unnecessary User instantiation

Change-Id: I224c8d4bff3cc90260b9f44e321cf4738f80a1b5
This commit is contained in:
Matěj Suchánek 2022-12-16 19:05:35 +01:00
parent 4d44d4f900
commit 8a8e3badfd

View file

@ -510,9 +510,6 @@ abstract class EchoDiscussionParser {
}
$userIdentity = $revision->getUser();
$userID = $userIdentity ? $userIdentity->getId() : 0;
$userName = $userIdentity ? $userIdentity->getName() : '';
$user = $userID !== 0 ? User::newFromId( $userID ) : User::newFromName( $userName, false );
$prevText = '';
if ( $revision->getParentId() ) {
@ -531,7 +528,7 @@ abstract class EchoDiscussionParser {
);
$output = self::interpretDiff(
$changes,
$user->getName(),
$userIdentity ? $userIdentity->getName() : '',
Title::newFromLinkTarget( $revision->getPageAsLinkTarget() )
);