Don't put a whole User object in extra[mentioned-users]

DiscussionParser::getUserMentions() returns mentions in an array of the
form [ID => ID]. UserLocator says "we shouldn't receive User instances,
but allow it for backward compatability". But
DiscussionParser::generateEventsForRevision() was putting User objects
into the extra when there is a mention in the edit summary.

I noticed this when I accidentally made User objects be unserializable
in a core patch.

So, I made generateEventsForRevision() generate mention arrays in the
same ID=>ID format as getUserMentions().

Change-Id: I7c6d25950c8887b50426863c7b0a2d5d007559dd
This commit is contained in:
Tim Starling 2020-05-05 14:31:24 +10:00
parent 4b6c8fe025
commit 41d53fde50

View file

@ -124,7 +124,7 @@ abstract class EchoDiscussionParser {
if ( $count >= $wgEchoMaxMentionsInEditSummary ) {
break;
}
$mentionedUsers[] = $summaryUser;
$mentionedUsers[$summaryUser->getId()] = $summaryUser->getId();
$count++;
}