]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/actions/groupsalmon.php
Merge remote branch 'statusnet/1.0.x' into idle-irc-plugin
[quix0rs-gnu-social.git] / plugins / OStatus / actions / groupsalmon.php
index 2e4fe94436aa747ae4f7809cbff33081b2cc0fca..d60725a71b7e4866625d96242fbca306858f207e 100644 (file)
@@ -46,6 +46,11 @@ class GroupsalmonAction extends SalmonAction
             $this->clientError(_('No such group.'));
         }
 
+        $oprofile = Ostatus_profile::staticGet('group_id', $id);
+        if ($oprofile) {
+            $this->clientError(_m("Can't accept remote posts for a remote group."));
+        }
+
         return true;
     }
 
@@ -55,7 +60,8 @@ class GroupsalmonAction extends SalmonAction
 
     function handlePost()
     {
-        switch ($this->act->object->type) {
+        // @fixme process all objects?
+        switch ($this->act->objects[0]->type) {
         case ActivityObject::ARTICLE:
         case ActivityObject::BLOGENTRY:
         case ActivityObject::NOTE:
@@ -74,13 +80,13 @@ class GroupsalmonAction extends SalmonAction
             throw new ClientException("Not to the attention of anyone.");
         } else {
             $uri = common_local_url('groupbyid', array('id' => $this->group->id));
-            if (!in_array($context->attention, $uri)) {
+            if (!in_array($uri, $context->attention)) {
                 throw new ClientException("Not to the attention of this group.");
             }
         }
 
         $profile = $this->ensureProfile();
-        // @fixme save the post
+        $this->saveNotice();
     }
 
     /**