From 6401bd7503900fb1f8a885cb53baab91d568cfab Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 9 Jan 2021 16:56:42 +0000 Subject: [PATCH] Mark if post was received via relay --- mod/dfrn_notify.php | 4 +--- src/Model/Conversation.php | 4 ++++ src/Protocol/ActivityPub/Processor.php | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 1d29be3de0..3f38eccd30 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -36,8 +36,6 @@ use Friendica\Util\Network; use Friendica\Util\Strings; function dfrn_notify_post(App $a) { - Logger::log(__function__, Logger::TRACE); - $postdata = Network::postdata(); if (empty($_POST) || !empty($postdata)) { @@ -225,7 +223,7 @@ function dfrn_dispatch_public($postdata) Logger::log('Importing post from ' . $msg['author'] . ' with the public envelope.', Logger::DEBUG); // Now we should be able to import it - $ret = DFRN::import($msg['message'], $importer, Conversation::PARCEL_DIASPORA_DFRN, Conversation::PUSH); + $ret = DFRN::import($msg['message'], $importer, Conversation::PARCEL_DIASPORA_DFRN, Conversation::RELAY); System::xmlExit($ret, 'Done'); } diff --git a/src/Model/Conversation.php b/src/Model/Conversation.php index febd6c5084..c51f19f171 100644 --- a/src/Model/Conversation.php +++ b/src/Model/Conversation.php @@ -57,6 +57,10 @@ class Conversation * The message had been fetched by our system */ const PULL = 2; + /** + * The message had been pushed to this system via a relay server + */ + const RELAY = 3; public static function getByItemUri($item_uri) { diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index aa0d145fc6..52aaa9741e 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -297,6 +297,10 @@ class Processor } } + if (!empty($activity['from-relay'])) { + $item['direction'] = Conversation::RELAY; + } + $item['isForum'] = false; if (!empty($activity['thread-completion'])) {