Stricter typing + user detection in Realtime

This commit is contained in:
Mikael Nordfeldth 2014-03-06 13:23:08 +01:00
parent c5c4bc10dc
commit 3be0e44490

View File

@ -22,14 +22,14 @@
* @category Plugin * @category Plugin
* @package StatusNet * @package StatusNet
* @author Evan Prodromou <evan@status.net> * @author Evan Prodromou <evan@status.net>
* @author Mikael Nordfeldth <mmn@hethane.se>
* @copyright 2009 StatusNet, Inc. * @copyright 2009 StatusNet, Inc.
* @copyright 2014 Free Software Foundation, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
if (!defined('STATUSNET')) { if (!defined('GNUSOCIAL')) { exit(1); }
exit(1);
}
/** /**
* Superclass for plugin to do realtime updates * Superclass for plugin to do realtime updates
@ -148,7 +148,7 @@ class RealtimePlugin extends Plugin
return true; return true;
} }
function onHandleQueuedNotice($notice) public function onHandleQueuedNotice(Notice $notice)
{ {
$paths = array(); $paths = array();
@ -161,10 +161,12 @@ class RealtimePlugin extends Plugin
return true; return true;
} }
$user = User::getKV('id', $notice->profile_id); try {
$user = $profile->getUser();
if (!empty($user)) {
$paths[] = array('showstream', $user->nickname, null); $paths[] = array('showstream', $user->nickname, null);
} catch (NoSuchUserException $e) {
// We really should handle the remote profile views too
$user = null;
} }
// Add to the public timeline // Add to the public timeline