X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FActivity%2FActivityPlugin.php;h=0d8508e06d9cf5bbc1427cf188b60377ac3e9049;hb=d8f4de450c7bddab525ee5059f856b50cfb59068;hp=99c0a246c6daaa66bae1974bbd2f9e7360a6c776;hpb=1ee79dc3791162f7ef9b92befaef597328266ce1;p=quix0rs-gnu-social.git diff --git a/plugins/Activity/ActivityPlugin.php b/plugins/Activity/ActivityPlugin.php index 99c0a246c6..0d8508e06d 100644 --- a/plugins/Activity/ActivityPlugin.php +++ b/plugins/Activity/ActivityPlugin.php @@ -279,15 +279,11 @@ class ActivityPlugin extends Plugin $adapter = null; switch ($notice->verb) { - case ActivityVerb::FAVORITE: - case ActivityVerb::UNFAVORITE: - $adapter = new SystemListItem($nli); - break; case ActivityVerb::JOIN: $adapter = new JoinListItem($nli); break; case ActivityVerb::LEAVE: - $adapter = new JoinListItem($nli); + $adapter = new LeaveListItem($nli); break; case ActivityVerb::FOLLOW: $adapter = new FollowListItem($nli); @@ -308,45 +304,30 @@ class ActivityPlugin extends Plugin return true; } - function onEndNoticeAsActivity($notice, &$activity) + public function onEndNoticeAsActivity(Notice $stored, Activity $act, Profile $scoped=null) { - switch ($notice->verb) { - case ActivityVerb::FAVORITE: - $fave = Fave::getKV('uri', $notice->uri); - if (!empty($fave)) { - $notice = Notice::getKV('id', $fave->notice_id); - if (!empty($notice)) { - $cur = common_current_user(); - $target = $notice->asActivity($cur); - if ($target->verb == ActivityVerb::POST) { - // "I like the thing you posted" - $activity->objects = $target->objects; - } else { - // "I like that you did whatever you did" - $activity->objects = array($target); - } - } - } - break; + switch ($stored->verb) { case ActivityVerb::UNFAVORITE: // FIXME: do something here break; case ActivityVerb::JOIN: - $mem = Group_member::getKV('uri', $notice->uri); - if (!empty($mem)) { + $mem = Group_member::getKV('uri', $stored->getUri()); + if ($mem instanceof Group_member) { $group = $mem->getGroup(); - $activity->objects = array(ActivityObject::fromGroup($group)); + $act->title = $stored->getTitle(); + $act->objects = array(ActivityObject::fromGroup($group)); } break; case ActivityVerb::LEAVE: // FIXME: ???? break; case ActivityVerb::FOLLOW: - $sub = Subscription::getKV('uri', $notice->uri); - if (!empty($sub)) { + $sub = Subscription::getKV('uri', $stored->uri); + if ($sub instanceof Subscription) { $profile = Profile::getKV('id', $sub->subscribed); - if (!empty($profile)) { - $activity->objects = array($profile->asActivityObject()); + if ($profile instanceof Profile) { + $act->title = $stored->getTitle(); + $act->objects = array($profile->asActivityObject()); } } break;