]> git.mxchange.org Git - friendica.git/commitdiff
Add more post reasons
authorMichael <heluecht@pirati.ca>
Fri, 29 Jul 2022 21:28:22 +0000 (21:28 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 29 Jul 2022 21:28:22 +0000 (21:28 +0000)
src/Content/Conversation.php
src/Model/Item.php
src/Protocol/ActivityPub/Processor.php
src/Protocol/ActivityPub/Receiver.php

index 36fd38915d22098fde82b4ea223d6361436a94c2..cf62636fc0f146148632dc74c26bb046a0f87998 100644 (file)
@@ -901,7 +901,9 @@ class Conversation
                        case ItemModel::PR_DISTRIBUTE:
                                $row['direction'] = ['direction' => 6, 'title' => $this->l10n->t('Distributed')];
                                break;
-
+                       case ItemModel::PR_PUSHED:
+                               $row['direction'] = ['direction' => 1, 'title' => $this->l10n->t('Pushed to us')];
+                               break;
                }
 
                $row['thr-parent-row'] = $thr_parent;
index 73a6e65c577ba6c37c9367df518a8f0769bdc526..6772a85fa20da45d33a666facd189a064dc9e820 100644 (file)
@@ -79,6 +79,8 @@ class Item
        const PR_DIRECT = 77;
        const PR_ACTIVITY = 78;
        const PR_DISTRIBUTE = 79;
+       const PR_PUSHED = 80;
+       const PR_LOCAL = 81;
 
        // system.accept_only_sharer setting values
        const COMPLETION_NONE    = 1;
@@ -908,6 +910,10 @@ class Item
                        $item['post-reason'] = self::PR_FOLLOWER;
                }
 
+               if ($item['origin'] && empty($item['post-reason'])) {
+                       $item['post-reason'] = self::PR_LOCAL;
+               }
+
                // Ensure that there is an avatar cache
                Contact::checkAvatarCache($item['author-id']);
                Contact::checkAvatarCache($item['owner-id']);
index 60dd42cb49349915ef1baee30a72cd6286689398..2438c68c6b03cdb89df924e1a27eac4102753f4f 100644 (file)
@@ -363,10 +363,10 @@ class Processor
                if (!empty($activity['raw'])) {
                        $item['source'] = $activity['raw'];
                        $item['protocol'] = Conversation::PARCEL_ACTIVITYPUB;
+               }
 
-                       if (isset($activity['push'])) {
-                               $item['direction'] = $activity['push'] ? Conversation::PUSH : Conversation::PULL;
-                       }
+               if (isset($activity['push'])) {
+                       $item['direction'] = $activity['push'] ? Conversation::PUSH : Conversation::PULL;
                }
 
                if (!empty($activity['from-relay'])) {
@@ -900,6 +900,8 @@ class Processor
                                $item['post-reason'] = Item::PR_RELAY;
                        } elseif (!empty($activity['thread-completion'])) {
                                $item['post-reason'] = Item::PR_FETCHED;
+                       } elseif (in_array($item['post-reason'], [Item::PR_GLOBAL, Item::PR_NONE]) && !empty($activity['push'])) {
+                               $item['post-reason'] = Item::PR_PUSHED;
                        }
 
                        if ($item['isForum'] ?? false) {
index 600fe315240a86ed9cd17cdbcc311206c9df9970..2231d0acbd3f8e673746f0097111b9a53c2eb45a 100644 (file)
@@ -986,7 +986,7 @@ class Receiver
                }
 
                if (!empty($reply)) {
-                       $parents = Post::select(['uid'], ['uri' => $reply]);
+                       $parents = Post::select(['uid'], DBA::mergeConditions(['uri' => $reply], ["`uid` != ?", 0]));
                        while ($parent = Post::fetch($parents)) {
                                $receivers[$parent['uid']] = ['uid' => $parent['uid'], 'type' => self::TARGET_ANSWER];
                        }