mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-23 23:44:53 +00:00
(bug 46051) mentioned users should not be as object in database
Change-Id: Id96ade333d8150fdc357db47cba9a609f9e7e108
This commit is contained in:
parent
909d45c156
commit
345fdb81e2
|
@ -191,7 +191,14 @@ class EchoHooks {
|
|||
break;
|
||||
case 'mention':
|
||||
$extraData = $event->getExtra();
|
||||
$users += $extraData['mentioned-users'];
|
||||
foreach ( $extraData['mentioned-users'] as $userId ) {
|
||||
//backward compatibility
|
||||
if ( $userId instanceof User ) {
|
||||
$users[$userId->getID()] = $userId;
|
||||
} else {
|
||||
$users[$userId] = User::newFromId( $userId );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ abstract class EchoDiscussionParser {
|
|||
$output = self::parseNonEditWikitext( $content, new Article( $title ) );
|
||||
$links = $output->getLinks();
|
||||
$mentionedUsers = array();
|
||||
$count = 0;
|
||||
|
||||
foreach ( $links[NS_USER] as $dbk => $page_id ) {
|
||||
$user = User::newFromName( $dbk );
|
||||
|
@ -117,7 +118,12 @@ abstract class EchoDiscussionParser {
|
|||
) {
|
||||
continue;
|
||||
}
|
||||
$mentionedUsers[$user->getId()] = $user;
|
||||
$mentionedUsers[$user->getId()] = $user->getId();
|
||||
$count++;
|
||||
// This is an unbounded list, put a cap on the allowable mentioned user list
|
||||
if ( $count > 300 ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$mentionedUsers ) {
|
||||
|
|
Loading…
Reference in a new issue