summaryrefslogtreecommitdiff
path: root/plugins/OStatus
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-02-20 20:34:29 -0500
committerEvan Prodromou <evan@status.net>2010-02-20 20:34:29 -0500
commit0c62c686756de0752cdd44b63c10cf6e4047860f (patch)
tree6478035175ea548a99822f07a207d439422a149e /plugins/OStatus
parenta3de4caf497b5d4a4d34477279fefe4c4d7ad8e2 (diff)
do some double-checks on favor and disfavor handlers in OStatusPlugin
Diffstat (limited to 'plugins/OStatus')
-rw-r--r--plugins/OStatus/OStatusPlugin.php23
1 files changed, 18 insertions, 5 deletions
diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php
index 5081c4d98..29799b0dc 100644
--- a/plugins/OStatus/OStatusPlugin.php
+++ b/plugins/OStatus/OStatusPlugin.php
@@ -365,16 +365,21 @@ class OStatusPlugin extends Plugin
* @param Notice $notice being favored
* @return hook return value
*/
- function onEndFavorNotice($profile, Notice $notice)
+ function onEndFavorNotice(Profile $profile, Notice $notice)
{
- if ($profile instanceof User) {
- // @fixme upstream function should clarify its parameters
- $profile = $profile->getProfile();
+ $user = User::staticGet('id', $profile->id);
+
+ if (empty($user)) {
+ return true;
}
+
$oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
+
if ($oprofile) {
$oprofile->notify($profile, ActivityVerb::FAVORITE, $notice);
}
+
+ return true;
}
/**
@@ -386,10 +391,18 @@ class OStatusPlugin extends Plugin
*/
function onEndDisfavorNotice(Profile $profile, Notice $notice)
{
+ $user = User::staticGet('id', $profile->id);
+
+ if (empty($user)) {
+ return true;
+ }
+
$oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
+
if ($oprofile) {
$oprofile->notify($profile, ActivityVerb::UNFAVORITE, $notice);
}
- }
+ return true;
+ }
}