(bug 46051) mentioned users should not be as object in database

Change-Id: Id96ade333d8150fdc357db47cba9a609f9e7e108
This commit is contained in:
bsitu 2013-03-13 12:30:20 -07:00
parent 909d45c156
commit 345fdb81e2
2 changed files with 15 additions and 2 deletions

View file

@ -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;
}

View file

@ -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 ) {