]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/microappplugin.php
Better typing and minor fixes to OStatus related stuff
[quix0rs-gnu-social.git] / lib / microappplugin.php
index a723ecde420f805e0ace47e0ecf6244ddbe324d2..8cb1450788e9f576bd9397310424f4434ef03aaa 100644 (file)
@@ -175,7 +175,7 @@ abstract class MicroAppPlugin extends Plugin
      */
     function isMyNotice($notice) {
         $types = $this->types();
-        return in_array($notice->object_type, $types);
+        return ($notice->verb == ActivityVerb::POST) && in_array($notice->object_type, $types);
     }
 
     /**
@@ -194,6 +194,7 @@ abstract class MicroAppPlugin extends Plugin
         $types = $this->types();
         return (count($activity->objects) == 1 &&
                 ($activity->objects[0] instanceof ActivityObject) &&
+                ($activity->verb == ActivityVerb::POST) &&
                 in_array($activity->objects[0]->type, $types));
     }
 
@@ -352,7 +353,7 @@ abstract class MicroAppPlugin extends Plugin
 
             $actor = $oprofile->checkAuthorship($activity);
 
-            if (empty($actor)) {
+            if (!$actor instanceof Ostatus_profile) {
                 // TRANS: Client exception thrown when no author for an activity was found.
                 throw new ClientException(_('Cannot get author for activity.'));
             }
@@ -389,19 +390,19 @@ abstract class MicroAppPlugin extends Plugin
 
             if ($target instanceof User_group) {
                 $uri = $target->getUri();
-                if (!in_array($uri, $activity->context->attention)) {
+                if (!array_key_exists($uri, $activity->context->attention)) {
                     // @todo FIXME: please document (i18n).
                     // TRANS: Client exception thrown when ...
-                    throw new ClientException(_('Bookmark not posted to this group.'));
+                    throw new ClientException(_('Object not posted to this group.'));
                 }
             } else if ($target instanceof User) {
                 $uri      = $target->uri;
                 $original = null;
                 if (!empty($activity->context->replyToID)) {
-                    $original = Notice::staticGet('uri',
+                    $original = Notice::getKV('uri',
                                                   $activity->context->replyToID);
                 }
-                if (!in_array($uri, $activity->context->attention) &&
+                if (!array_key_exists($uri, $activity->context->attention) &&
                     (empty($original) ||
                      $original->profile_id != $target->id)) {
                     // @todo FIXME: Please document (i18n).