From 3be0e444906716d114eff5ec8d6bf56a8ae86521 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Thu, 6 Mar 2014 13:23:08 +0100 Subject: [PATCH] Stricter typing + user detection in Realtime --- plugins/Realtime/RealtimePlugin.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index 05bb7714ed..32dfbcf7d4 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -22,14 +22,14 @@ * @category Plugin * @package StatusNet * @author Evan Prodromou + * @author Mikael Nordfeldth * @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 * @link http://status.net/ */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } /** * Superclass for plugin to do realtime updates @@ -148,7 +148,7 @@ class RealtimePlugin extends Plugin return true; } - function onHandleQueuedNotice($notice) + public function onHandleQueuedNotice(Notice $notice) { $paths = array(); @@ -161,10 +161,12 @@ class RealtimePlugin extends Plugin return true; } - $user = User::getKV('id', $notice->profile_id); - - if (!empty($user)) { + try { + $user = $profile->getUser(); $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 -- 2.39.5