From 5d6eb4670aba01ea83458541b04bbc1a5d311181 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 23 Jul 2022 13:58:14 +0000 Subject: [PATCH] We now store the conversation as well --- database.sql | 1 + doc/database/db_inbox-entry.md | 1 + src/Protocol/ActivityPub/Processor.php | 2 +- src/Protocol/ActivityPub/Queue.php | 6 ++++++ static/dbstructure.config.php | 1 + 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/database.sql b/database.sql index eb97ec3074..42624d4d1d 100644 --- a/database.sql +++ b/database.sql @@ -732,6 +732,7 @@ CREATE TABLE IF NOT EXISTS `inbox-entry` ( `activity-id` varbinary(255) COMMENT 'id of the incoming activity', `object-id` varbinary(255) COMMENT '', `in-reply-to-id` varbinary(255) COMMENT '', + `conversation` varbinary(255) COMMENT '', `type` varchar(64) COMMENT 'Type of the activity', `object-type` varchar(64) COMMENT 'Type of the object activity', `object-object-type` varchar(64) COMMENT 'Type of the object\'s object activity', diff --git a/doc/database/db_inbox-entry.md b/doc/database/db_inbox-entry.md index 91126919e9..32dd1203dc 100644 --- a/doc/database/db_inbox-entry.md +++ b/doc/database/db_inbox-entry.md @@ -12,6 +12,7 @@ Fields | activity-id | id of the incoming activity | varbinary(255) | YES | | NULL | | | object-id | | varbinary(255) | YES | | NULL | | | in-reply-to-id | | varbinary(255) | YES | | NULL | | +| conversation | | varbinary(255) | YES | | NULL | | | type | Type of the activity | varchar(64) | YES | | NULL | | | object-type | Type of the object activity | varchar(64) | YES | | NULL | | | object-object-type | Type of the object's object activity | varchar(64) | YES | | NULL | | diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 9c7cfef77d..4b02ae8103 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -695,7 +695,7 @@ class Processor Logger::warning('Unknown parent item.', ['uri' => $parent_uri]); return false; } - if (($parent['private'] == Item::PRIVATE) && ($parent['private'] != Item::PRIVATE)) { + if (($item['private'] == Item::PRIVATE) && ($parent['private'] != Item::PRIVATE)) { Logger::warning('Item is private but the parent is not. Dropping.', ['item-uri' => $item['uri'], 'thr-parent' => $item['thr-parent']]); return false; } diff --git a/src/Protocol/ActivityPub/Queue.php b/src/Protocol/ActivityPub/Queue.php index 055a728dfb..279f2108b7 100644 --- a/src/Protocol/ActivityPub/Queue.php +++ b/src/Protocol/ActivityPub/Queue.php @@ -57,6 +57,12 @@ class Queue $fields['in-reply-to-id'] = $activity['reply-to-id']; } + if (!empty($activity['context'])) { + $fields['conversation'] = $activity['context']; + } elseif(!empty($activity['conversation'])) { + $fields['conversation'] = $activity['conversation']; + } + if (!empty($activity['object_object_type'])) { $fields['object-object-type'] = $activity['object_object_type']; } diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 74bcdc8161..0b6af9b13a 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -791,6 +791,7 @@ return [ "activity-id" => ["type" => "varbinary(255)", "comment" => "id of the incoming activity"], "object-id" => ["type" => "varbinary(255)", "comment" => ""], "in-reply-to-id" => ["type" => "varbinary(255)", "comment" => ""], + "conversation" => ["type" => "varbinary(255)", "comment" => ""], "type" => ["type" => "varchar(64)", "comment" => "Type of the activity"], "object-type" => ["type" => "varchar(64)", "comment" => "Type of the object activity"], "object-object-type" => ["type" => "varchar(64)", "comment" => "Type of the object's object activity"],