diff options
-rw-r--r-- | CHANGELOG | 6 | ||||
-rw-r--r-- | Zotlabs/Lib/Activity.php | 25 | ||||
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 31 | ||||
-rw-r--r-- | include/items.php | 4 |
4 files changed, 54 insertions, 12 deletions
@@ -1,3 +1,9 @@ +Hubzilla 9.4.3 (2024-10-10) + - Discard Add/Remove activities (Hubzilla 10 and (streams) compatibility) + - Fix HQ channel activities icons + - Fix saved search icons + + Hubzilla 9.4.2 (2024-10-04) - Indicate reacted state via icon color (community wish) - Fix modal backdrop not removed when reacting from the modal diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 1ea42acd3..90d7af8e8 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -3054,13 +3054,6 @@ class Activity { } $a = new ActivityStreams($n); - if ($a->type === 'Announce' && is_array($a->obj) - && array_key_exists('object', $a->obj) && array_key_exists('actor', $a->obj)) { - // This is a relayed/forwarded Activity (as opposed to a shared/boosted object) - // Reparse the encapsulated Activity and use that instead - logger('relayed activity', LOGGER_DEBUG); - $a = new ActivityStreams($a->obj); - } logger($a->debug(), LOGGER_DATA); @@ -3069,6 +3062,24 @@ class Activity { break; } + if (in_array($a->type, ['Add', 'Remove']) + && is_array($a->obj) + && array_key_exists('object', $a->obj) + && array_key_exists('actor', $a->obj) + && !empty($a->tgt)) { + + logger('unsupported collection operation', LOGGER_DEBUG); + return; + } + + if ($a->type === 'Announce' && is_array($a->obj) + && array_key_exists('object', $a->obj) && array_key_exists('actor', $a->obj)) { + // This is a relayed/forwarded Activity (as opposed to a shared/boosted object) + // Reparse the encapsulated Activity and use that instead + logger('relayed activity', LOGGER_DEBUG); + $a = new ActivityStreams($a->obj); + } + $item = Activity::decode_note($a); if (!$item) { diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index bc944c97c..05134f433 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1148,6 +1148,17 @@ class Libzot { logger('Activity rejected: ' . print_r($data, true)); return; } + + if (in_array($AS->type, ['Add', 'Remove']) + && is_array($AS->obj) + && array_key_exists('object', $AS->obj) + && array_key_exists('actor', $AS->obj) + && !empty($AS->tgt)) { + + logger('unsupported collection operation', LOGGER_DEBUG); + return; + } + if (is_array($AS->obj)) { $item = Activity::decode_note($AS); if (!$item) { @@ -1158,6 +1169,7 @@ class Libzot { else { $item = []; } + logger($AS->debug(), LOGGER_DATA); } @@ -2006,7 +2018,13 @@ class Libzot { foreach ($items as $activity) { $AS = new ActivityStreams($activity); - if ($AS->is_valid() && $AS->type === 'Announce' && is_array($AS->obj) + + if (!$AS->is_valid()) { + logger('Fetched activity rejected: ' . print_r($activity, true)); + continue; + } + + if ($AS->type === 'Announce' && is_array($AS->obj) && array_key_exists('object', $AS->obj) && array_key_exists('actor', $AS->obj)) { // This is a relayed/forwarded Activity (as opposed to a shared/boosted object) // Reparse the encapsulated Activity and use that instead @@ -2014,9 +2032,14 @@ class Libzot { $AS = new ActivityStreams($AS->obj); } - if (!$AS->is_valid()) { - logger('Fetched activity rejected: ' . print_r($activity, true)); - continue; + if (in_array($AS->type, ['Add', 'Remove']) + && is_array($AS->obj) + && array_key_exists('object', $AS->obj) + && array_key_exists('actor', $AS->obj) + && !empty($AS->tgt)) { + + logger('unsupported collection operation', LOGGER_DEBUG); + return; } // logger($AS->debug()); diff --git a/include/items.php b/include/items.php index 23222892f..876c20099 100644 --- a/include/items.php +++ b/include/items.php @@ -3196,7 +3196,9 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false } else { - $arr['uuid'] = item_message_id(); + // To prevent duplicates from possible clones of the forum/group, + // will create a v5 UUID of the source item mid. + $arr['uuid'] = uuid_from_url($item['mid']); $arr['mid'] = z_root() . '/item/' . $arr['uuid']; $arr['parent_mid'] = $arr['mid']; } |