aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/Activity.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2024-10-09 22:43:01 +0200
committerMario Vavti <mario@mariovavti.com>2024-10-09 22:43:01 +0200
commitc2ce1d988136c848c1b0cbad5ffdddacca82901d (patch)
treeaabfe29409ad7e2d53bfaa8ea9f962ebe21e2e80 /Zotlabs/Lib/Activity.php
parent8cee16be1b774af1f2ec85d7778776e1d8b03e50 (diff)
downloadvolse-hubzilla-c2ce1d988136c848c1b0cbad5ffdddacca82901d.tar.gz
volse-hubzilla-c2ce1d988136c848c1b0cbad5ffdddacca82901d.tar.bz2
volse-hubzilla-c2ce1d988136c848c1b0cbad5ffdddacca82901d.zip
containers: send add in mod like, send remove on delete
Diffstat (limited to 'Zotlabs/Lib/Activity.php')
-rw-r--r--Zotlabs/Lib/Activity.php26
1 files changed, 23 insertions, 3 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index dfbdacf18..f10a2bace 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -846,12 +846,32 @@ class Activity {
$ret['type'] = self::activity_mapper($i['verb']);
if ((isset($i['item_deleted']) && intval($i['item_deleted'])) && !$recurse) {
- $is_response = false;
- if (ActivityStreams::is_response_activity($ret['type'])) {
+ if ($i['verb'] === 'Add' && str_contains($i['tgt_type'], 'Collection')) {
+ $ret['id'] = str_replace('/item/', '/activity/', $i['mid']) . '#Remove';
+ $ret['type'] = 'Remove';
+ if (is_string($i['obj'])) {
+ $obj = json_decode($i['obj'], true);
+ }
+ elseif(is_array($i['obj'])) {
+ $obj = $i['obj'];
+ }
+ if (isset($obj['id'])) {
+ $ret['object'] = $obj['id'];
+ }
+ else {
+ $ret['object'] = str_replace('/item/', '/activity/', $i['mid']);
+ }
+ $ret['target'] = is_array($i['target']) ? $i['target'] : json_decode($i['target'], true);
+
+ return $ret;
+ }
+
+ $is_response = ActivityStreams::is_response_activity($ret['type']);
+
+ if ($is_response) {
$ret['type'] = 'Undo';
$fragment = 'undo';
- $is_response = true;
}
else {
$ret['type'] = 'Delete';