]> git.mxchange.org Git - friendica.git/commitdiff
"MIRROR_FORWARDED" is removed
authorMichael <heluecht@pirati.ca>
Wed, 23 Nov 2022 14:00:34 +0000 (14:00 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 23 Nov 2022 14:00:34 +0000 (14:00 +0000)
src/Core/Protocol.php
src/Model/Contact.php
src/Model/Item.php
src/Module/Contact/Profile.php

index 015612adeaea1af9575727792f25b89ef41e965c..096e12c27bd19979eee61950211035bfaa732490 100644 (file)
@@ -205,6 +205,7 @@ class Protocol
                        $slap = OStatus::salmon($item, $user);
 
                        if (empty($contact['notify'])) {
+                               return true;
                                throw new \InvalidArgumentException('Missing expected "notify" key in OStatus/DFRN contact');
                        }
 
index ce392217dd4d127bc66b894325c71b012d3a59fc..e0c3c1682a9dcd1be8cf1d0d1673ba62075ac362 100644 (file)
@@ -106,7 +106,7 @@ class Contact
         */
 
         const MIRROR_DEACTIVATED = 0;
-        const MIRROR_FORWARDED = 1;
+        const MIRROR_FORWARDED = 1; // Deprecated, now does the same like MIRROR_OWN_POST
         const MIRROR_OWN_POST = 2;
         const MIRROR_NATIVE_RESHARE = 3;
 
index 6858baec0e13f73726cd1dc4d4cfdcbc5512cae8..48c578e85f7b75c40d1daf811806b3e006d85969 100644 (file)
@@ -823,19 +823,38 @@ class Item
                $item['protocol'] = Conversation::PARCEL_DIRECT;
                $item['direction'] = Conversation::PUSH;
 
-               if (!empty($item['author-link']) && !empty($item['author-id'])) {
-                       $owner = User::getOwnerDataById($item['uid']);
+               $owner = User::getOwnerDataById($item['uid']);
+
+               if (empty($item['contact-id'])) {
+                       $item['contact-id'] = $owner['id'];
+               }
+
+               if (empty($item['author-link']) && empty($item['author-id'])) {
                        $item['author-link']   = $owner['url'];
                        $item['author-name']   = $owner['name'];
                        $item['author-avatar'] = $owner['thumb'];
                }
 
-               if (!empty($item['owner-link']) && !empty($item['owner-id'])) {
+               if (empty($item['owner-link']) && empty($item['owner-id'])) {
                        $item['owner-link']   = $item['author-link'];
                        $item['owner-name']   = $item['author-name'];
                        $item['owner-avatar'] = $item['author-avatar'];
                }
 
+               // Setting the object type if not defined before
+               if (empty($item['object-type'])) {
+                       $item['object-type'] = Activity\ObjectType::NOTE; // Default value
+                       $objectdata = BBCode::getAttachedData($item['body']);
+
+                       if ($objectdata['type'] == 'link') {
+                               $item['object-type'] = Activity\ObjectType::BOOKMARK;
+                       } elseif ($objectdata['type'] == 'video') {
+                               $item['object-type'] = Activity\ObjectType::VIDEO;
+                       } elseif ($objectdata['type'] == 'photo') {
+                               $item['object-type'] = Activity\ObjectType::IMAGE;
+                       }
+               }
+
                return $item;
        }
 
index ecb25dd60701e33e95c356f83044274d21a7d39a..b3d0c037339e8c5154e53e56a1f54d079a0ca390 100644 (file)
@@ -285,7 +285,6 @@ class Profile extends BaseModule
                if ($contact['network'] == Protocol::FEED) {
                        $remote_self_options = [
                                Contact::MIRROR_DEACTIVATED => $this->t('No mirroring'),
-                               Contact::MIRROR_FORWARDED   => $this->t('Mirror as forwarded posting'),
                                Contact::MIRROR_OWN_POST    => $this->t('Mirror as my own posting')
                        ];
                } elseif ($contact['network'] == Protocol::ACTIVITYPUB) {