]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Activity/ActivityPlugin.php
Merge commit 'refs/merge-requests/36' of https://gitorious.org/social/mainline into...
[quix0rs-gnu-social.git] / plugins / Activity / ActivityPlugin.php
index 3f2cee11d2ad197aa18bdb18797d3284d97f7267..0d8508e06d9cf5bbc1427cf188b60377ac3e9049 100644 (file)
@@ -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);
@@ -311,29 +307,14 @@ class ActivityPlugin extends Plugin
     public function onEndNoticeAsActivity(Notice $stored, Activity $act, Profile $scoped=null)
     {
         switch ($stored->verb) {
-        case ActivityVerb::FAVORITE:
-            $fave = Fave::getKV('uri', $stored->uri);
-            if (!empty($fave)) {
-                $stored = Notice::getKV('id', $fave->notice_id);
-                if (!empty($stored)) {
-                    $target = $stored->asActivity($scoped);
-                    if ($target->verb == ActivityVerb::POST) {
-                        // "I like the thing you posted"
-                        $act->objects = $target->objects;
-                    } else {
-                        // "I like that you did whatever you did"
-                        $act->objects = array($target);
-                    }
-                }
-            }
-            break;
         case ActivityVerb::UNFAVORITE:
             // FIXME: do something here
             break;
         case ActivityVerb::JOIN:
-            $mem = Group_member::getKV('uri', $stored->uri);
-            if (!empty($mem)) {
+            $mem = Group_member::getKV('uri', $stored->getUri());
+            if ($mem instanceof Group_member) {
                 $group = $mem->getGroup();
+                $act->title = $stored->getTitle();
                 $act->objects = array(ActivityObject::fromGroup($group));
             }
             break;
@@ -342,9 +323,10 @@ class ActivityPlugin extends Plugin
             break;
         case ActivityVerb::FOLLOW:
             $sub = Subscription::getKV('uri', $stored->uri);
-            if (!empty($sub)) {
+            if ($sub instanceof Subscription) {
                 $profile = Profile::getKV('id', $sub->subscribed);
-                if (!empty($profile)) {
+                if ($profile instanceof Profile) {
+                    $act->title = $stored->getTitle();
                     $act->objects = array($profile->asActivityObject());
                 }
             }