]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/Diaspora.php
Merge pull request #11260 from mkljczk/develop
[friendica.git] / src / Protocol / Diaspora.php
index db0b8435145cc1549503004c18fac5e653496a16..ea0b2b6749ab9a6b83c2749a5ad26e0c6335c156 100644 (file)
@@ -858,10 +858,6 @@ class Diaspora
                } elseif (($contact["rel"] == Contact::SHARING) || ($contact["rel"] == Contact::FRIEND)) {
                        // Yes, then it is fine.
                        return true;
-                       // Is it a post to a community?
-               } elseif (($contact["rel"] == Contact::FOLLOWER) && in_array($importer["page-flags"], [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP])) {
-                       // That's good
-                       return true;
                        // Is the message a global user or a comment?
                } elseif (($importer["uid"] == 0) || $is_comment) {
                        // Messages for the global users and comments are always accepted
@@ -2712,6 +2708,9 @@ class Diaspora
 
                        $datarray["object-type"] = Activity\ObjectType::IMAGE;
                        $datarray["post-type"] = Item::PT_IMAGE;
+               } elseif ($data->poll) {
+                       $datarray["object-type"] = Activity\ObjectType::NOTE;
+                       $datarray["post-type"] = Item::PT_POLL;
                } else {
                        $datarray["object-type"] = Activity\ObjectType::NOTE;
                        $datarray["post-type"] = Item::PT_NOTE;
@@ -3411,7 +3410,7 @@ class Diaspora
 
                        $attachments = Post\Media::getByURIId($item['uri-id'], [Post\Media::DOCUMENT, Post\Media::TORRENT, Post\Media::UNKNOWN]);
                        if (!empty($attachments)) {
-                               $body .= "\n".DI::l10n()->t("Attachments:")."\n";
+                               $body .= "\n[hr]\n";
                                foreach ($attachments as $attachment) {
                                        $body .= "[" . $attachment['description'] . "](" . $attachment['url'] . ")\n";
                                }
@@ -3470,9 +3469,8 @@ class Diaspora
 
        private static function prependParentAuthorMention($body, $profile_url)
        {
-               $profile = Contact::getByURL($profile_url, false, ['addr', 'name', 'contact-type']);
+               $profile = Contact::getByURL($profile_url, false, ['addr', 'name']);
                if (!empty($profile['addr'])
-                       && $profile['contact-type'] != Contact::TYPE_COMMUNITY
                        && !strstr($body, $profile['addr'])
                        && !strstr($body, $profile_url)
                ) {
@@ -4100,6 +4098,9 @@ class Diaspora
                        $item['private'] = Item::PUBLIC;
                }
 
+               // Don't trigger the addons
+               $item['api_source'] = false;
+
                return Item::insert($item, true);
        }
 }