diff --git a/src/Content/Conversation.php b/src/Content/Conversation.php index 36fd38915d..cf62636fc0 100644 --- a/src/Content/Conversation.php +++ b/src/Content/Conversation.php @@ -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; diff --git a/src/Model/Item.php b/src/Model/Item.php index 73a6e65c57..6772a85fa2 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -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']); diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 60dd42cb49..2438c68c6b 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -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) { diff --git a/src/Protocol/ActivityPub/Receiver.php b/src/Protocol/ActivityPub/Receiver.php index 600fe31524..2231d0acbd 100644 --- a/src/Protocol/ActivityPub/Receiver.php +++ b/src/Protocol/ActivityPub/Receiver.php @@ -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]; }