mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-12 07:55:53 +00:00
Merge "DiscussionParser: Update some deprecated User methods"
This commit is contained in:
commit
26f98f35d6
|
@ -50,6 +50,7 @@ abstract class DiscussionParser {
|
||||||
global $wgEchoMentionOnChanges;
|
global $wgEchoMentionOnChanges;
|
||||||
$services = MediaWikiServices::getInstance();
|
$services = MediaWikiServices::getInstance();
|
||||||
$store = $services->getRevisionStore();
|
$store = $services->getRevisionStore();
|
||||||
|
$userFactory = $services->getUserFactory();
|
||||||
|
|
||||||
// use the replica database if there is a previous revision
|
// use the replica database if there is a previous revision
|
||||||
if ( $store->getPreviousRevision( $revision ) ) {
|
if ( $store->getPreviousRevision( $revision ) ) {
|
||||||
|
@ -67,10 +68,7 @@ abstract class DiscussionParser {
|
||||||
$events = [];
|
$events = [];
|
||||||
|
|
||||||
$interpretation = self::getChangeInterpretationForRevision( $revision );
|
$interpretation = self::getChangeInterpretationForRevision( $revision );
|
||||||
|
$user = $userFactory->newFromUserIdentity( $revision->getUser() );
|
||||||
$userID = $revision->getUser()->getId();
|
|
||||||
$userName = $revision->getUser()->getName();
|
|
||||||
$user = $userID !== 0 ? User::newFromId( $userID ) : User::newFromName( $userName, false );
|
|
||||||
|
|
||||||
foreach ( $interpretation as $action ) {
|
foreach ( $interpretation as $action ) {
|
||||||
if ( $action['type'] === 'add-comment' ) {
|
if ( $action['type'] === 'add-comment' ) {
|
||||||
|
@ -166,7 +164,7 @@ abstract class DiscussionParser {
|
||||||
$usersInSummary = $summaryParser->parse( $revision->getComment()->text );
|
$usersInSummary = $summaryParser->parse( $revision->getComment()->text );
|
||||||
|
|
||||||
// Don't allow pinging yourself
|
// Don't allow pinging yourself
|
||||||
unset( $usersInSummary[$userName] );
|
unset( $usersInSummary[$user->getName()] );
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$mentionedUsers = [];
|
$mentionedUsers = [];
|
||||||
|
|
Loading…
Reference in a new issue