From 1b18be671523c8ea85ecab8e5e1c5025e91c53e0 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 Oct 2018 18:47:32 +0000 Subject: [PATCH 1/3] The virtuel fields for the diaspora signatures have to be removed at any time --- src/Model/Item.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index c0c67352e..fe7757a46 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -1292,15 +1292,15 @@ class Item extends BaseObject if (x($item, 'dsprsig')) { $encoded_signature = $item['dsprsig']; $dsprsig = json_decode(base64_decode($item['dsprsig'])); - unset($item['dsprsig']); } + unset($item['dsprsig']); if (!empty($item['diaspora_signed_text'])) { $diaspora_signed_text = $item['diaspora_signed_text']; - unset($item['diaspora_signed_text']); } else { $diaspora_signed_text = ''; } + unset($item['diaspora_signed_text']); // Converting the plink /// @TODO Check if this is really still needed From 5af0ee1b9543e806ebec7e4583f9d98fa124f9b0 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 Oct 2018 18:53:13 +0000 Subject: [PATCH 2/3] We can now store it without any problem --- src/Protocol/ActivityPub/Processor.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 5d2d7fe11..166530f47 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -215,6 +215,7 @@ class Processor $item['tag'] = self::constructTagList($activity['tags'], $activity['sensitive']); $item['app'] = $activity['service']; $item['plink'] = defaults($activity, 'alternate-url', $item['uri']); + $item['diaspora_signed_text'] = defaults($activity, 'diaspora:comment', ''); $item = self::constructAttachList($activity['attachments'], $item); From 4d4dd1a99cce47d1f8cb3636ccf497222d00b6ff Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 Oct 2018 20:52:22 +0000 Subject: [PATCH 3/3] Some beautification --- src/Model/Item.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index fe7757a46..ed80f4e9e 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -1289,18 +1289,17 @@ class Item extends BaseObject */ $dsprsig = null; - if (x($item, 'dsprsig')) { + if (isset($item['dsprsig'])) { $encoded_signature = $item['dsprsig']; $dsprsig = json_decode(base64_decode($item['dsprsig'])); + unset($item['dsprsig']); } - unset($item['dsprsig']); - if (!empty($item['diaspora_signed_text'])) { + $diaspora_signed_text = ''; + if (isset($item['diaspora_signed_text'])) { $diaspora_signed_text = $item['diaspora_signed_text']; - } else { - $diaspora_signed_text = ''; + unset($item['diaspora_signed_text']); } - unset($item['diaspora_signed_text']); // Converting the plink /// @TODO Check if this is really still needed @@ -1488,6 +1487,7 @@ class Item extends BaseObject $deny_gid = ''; if ($item['parent-uri'] === $item['uri']) { + $diaspora_signed_text = ''; $parent_id = 0; $parent_deleted = 0; $allow_cid = $item['allow_cid']; @@ -1534,6 +1534,10 @@ class Item extends BaseObject $item['wall'] = $parent['wall']; $notify_type = 'comment-new'; + if (!$parent['origin']) { + $diaspora_signed_text = ''; + } + /* * If the parent is private, force privacy for the entire conversation * This differs from the above settings as it subtly allows comments from @@ -1574,6 +1578,7 @@ class Item extends BaseObject $parent_id = 0; $item['parent-uri'] = $item['uri']; $item['gravity'] = GRAVITY_PARENT; + $diaspora_signed_text = ''; } else { logger('item parent '.$item['parent-uri'].' for '.$item['uid'].' was not found - ignoring item'); return 0;