From: Mikael Nordfeldth Date: Thu, 6 Mar 2014 12:23:08 +0000 (+0100) Subject: Stricter typing + user detection in Realtime X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3be0e444906716d114eff5ec8d6bf56a8ae86521;p=quix0rs-gnu-social.git Stricter typing + user detection in Realtime --- 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