From 56e54ac820b32f4b5f7d3f554191079003ac78a5 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 28 Sep 2023 16:55:49 +0000 Subject: if the item is sourced and provides an event add it to the calendar --- Zotlabs/Lib/Libzot.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Lib/Libzot.php') diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 032fae3fc..383785992 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1871,8 +1871,9 @@ class Libzot { // if it's a sourced post, call the post_local hooks as if it were // posted locally so that crosspost connectors will be triggered. + $item_source = check_item_source($arr['uid'], $arr); - if (check_item_source($arr['uid'], $arr) || ($channel['xchan_pubforum'] == 1)) { + if ($item_source || ($channel['xchan_pubforum'] == 1)) { /** * @hooks post_local * Called when an item has been posted on this machine via mod/item.php (also via API). @@ -1898,7 +1899,13 @@ class Libzot { if (post_is_importable($arr['uid'], $arr, $abook)) { $item_result = item_store($arr); if ($item_result['success']) { + $item_id = $item_result['item_id']; + + if ($item_source && in_array($item_result['item']['obj_type'], ['Event', ACTIVITY_OBJ_EVENT])) { + event_addtocal($item_id, $channel['channel_id']); + } + $parr = [ 'item_id' => $item_id, 'item' => $arr, -- cgit v1.2.3 From 286104a988e4c21fc903518128317ce6abf204ce Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 25 Oct 2023 14:45:26 +0200 Subject: slightly less noise when logging normal --- Zotlabs/Lib/Libzot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Lib/Libzot.php') diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 383785992..fba9f118e 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -2013,7 +2013,7 @@ class Libzot { // logger($AS->debug()); if(empty($AS->actor['id'])) { - logger('No actor id!'); + logger('No actor id: ' . print_r($AS, true)); continue; } -- cgit v1.2.3 From c74068ae4d1b5af9dcaf9fac04cdabdcc5729b33 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 7 Nov 2023 08:33:22 +0000 Subject: libzot: correctly attribute streams repeats --- Zotlabs/Lib/Libzot.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Lib/Libzot.php') diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index fba9f118e..13cc8b1ae 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1114,6 +1114,7 @@ class Libzot { */ static function import($arr) { + $env = $arr; $private = false; $return = []; @@ -1219,13 +1220,20 @@ class Libzot { return; } - $r = Activity::get_actor_hublocs($AS->actor['id']); + $author_url = $AS->actor['id']; + + if ($AS->type === 'Announce') { + hz_syslog(print_r($AS, true)); + $author_url = Activity::get_attributed_to_actor_url($AS); + } + + $r = Activity::get_actor_hublocs($author_url); - if (! $r) { + if (!$r) { // Author is unknown to this site. Perform channel discovery and try again. - $z = discover_by_webbie($AS->actor['id']); + $z = discover_by_webbie($author_url); if ($z) { - $r = Activity::get_actor_hublocs($AS->actor['id']); + $r = Activity::get_actor_hublocs($author_url); } } @@ -1829,6 +1837,11 @@ class Libzot { if ($r) { // We already have this post. + // Dismiss its announce + if ($act->type === 'Announce') { + return; + } + $item_id = $r[0]['id']; if (intval($r[0]['item_deleted'])) { -- cgit v1.2.3 From 95c13eaf5a0f63b9b98fdff0fe887546953bc76f Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 7 Nov 2023 08:34:13 +0000 Subject: remove logging --- Zotlabs/Lib/Libzot.php | 1 - 1 file changed, 1 deletion(-) (limited to 'Zotlabs/Lib/Libzot.php') diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 13cc8b1ae..d7692ee4a 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1223,7 +1223,6 @@ class Libzot { $author_url = $AS->actor['id']; if ($AS->type === 'Announce') { - hz_syslog(print_r($AS, true)); $author_url = Activity::get_attributed_to_actor_url($AS); } -- cgit v1.2.3 From 42651707f82bb0f46153eb964d828787d9ba3c3c Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 7 Nov 2023 08:40:34 +0000 Subject: check if required keys are set --- Zotlabs/Lib/Libzot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Lib/Libzot.php') diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index d7692ee4a..e812dbd92 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1455,7 +1455,7 @@ class Libzot { if ($act && $act->obj) { if (isset($act->obj['tag']) && is_array($act->obj['tag']) && $act->obj['tag']) { foreach ($act->obj['tag'] as $tag) { - if ($tag['type'] === 'Mention' && (strpos($tag['href'], z_root()) !== false)) { + if (isset($tag['type'], $tag['href']) && $tag['type'] === 'Mention' && (strpos($tag['href'], z_root()) !== false)) { $address = basename($tag['href']); if ($address) { $z = q("select channel_hash as hash from channel where channel_address = '%s' and channel_hash != '%s' -- cgit v1.2.3 From 85d8c1a97eec7fe40c6ea4b9ee895897d54a38c6 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 9 Nov 2023 19:32:29 +0000 Subject: some low level work on native repeats --- Zotlabs/Lib/Libzot.php | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'Zotlabs/Lib/Libzot.php') diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index e812dbd92..e9cb2c35c 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1516,11 +1516,9 @@ class Libzot { */ static function process_delivery($sender, $act, $arr, $deliveries, $relay, $public = false, $request = false, $force = false) { - $result = []; // We've validated the sender. Now make sure that the sender is the owner or author - if (!$public) { if ($sender != $arr['owner_xchan'] && $sender != $arr['author_xchan']) { logger("Sender $sender is not owner {$arr['owner_xchan']} or author {$arr['author_xchan']} - mid {$arr['mid']}"); @@ -1641,6 +1639,13 @@ class Libzot { if (!$allowed && $permit_mentions) { $allowed = true; } + + if (!$allowed) { + if (PConfig::Get($channel['channel_id'], 'system', 'moderate_unsolicited_comments') && $arr['obj_type'] !== 'Answer') { + $arr['item_blocked'] = ITEM_MODERATED; + $allowed = true; + } + } } } elseif ($permit_mentions) { @@ -1649,7 +1654,6 @@ class Libzot { } if ($request) { - // Conversation fetches (e.g. $request == true) take place for // a) new comments on expired posts // b) hyperdrive (friend-of-friend) conversations @@ -1838,7 +1842,9 @@ class Libzot { // We already have this post. // Dismiss its announce if ($act->type === 'Announce') { - return; + $DR->update('update ignored'); + $result[] = $DR->get(); + continue; } $item_id = $r[0]['id']; @@ -1847,7 +1853,6 @@ class Libzot { // It was deleted locally. $DR->update('update ignored'); $result[] = $DR->get(); - continue; } // Maybe it has been edited? @@ -1855,17 +1860,17 @@ class Libzot { $arr['id'] = $r[0]['id']; $arr['uid'] = $channel['channel_id']; - if (post_is_importable($channel['channel_id'], $arr, $abook)) { - $item_result = self::update_imported_item($sender, $arr, $r[0], $channel['channel_id'], $tag_delivery); - $DR->update('updated'); - $result[] = $DR->get(); - if (!$relay) { - add_source_route($item_id, $sender); - } - } else { - $DR->update('update ignored'); - $result[] = $DR->get(); - } + if (post_is_importable($channel['channel_id'], $arr, $abook)) { + $item_result = self::update_imported_item($sender, $arr, $r[0], $channel['channel_id'], $tag_delivery); + $DR->update('updated'); + $result[] = $DR->get(); + if (!$relay) { + add_source_route($item_id, $sender); + } + } else { + $DR->update('update ignored'); + $result[] = $DR->get(); + } } else { $DR->update('update ignored'); @@ -1940,7 +1945,8 @@ class Libzot { add_source_route($item_id, $sender); } } - $DR->update(($item_id) ? 'posted' : 'storage failed: ' . $item_result['message']); + + $DR->update(($item_id) ? (($item_result['item']['item_blocked'] === ITEM_MODERATED) ? 'accepted for moderation' : 'posted') : 'storage failed: ' . $item_result['message']); $result[] = $DR->get(); } else { $DR->update('post ignored'); @@ -1957,7 +1963,7 @@ class Libzot { retain_item($stored['item']['parent']); } - if ($relay && $item_id) { + if ($relay && $item_id && $stored['item_blocked'] !== ITEM_MODERATED) { logger('Invoking relay'); Master::Summon(['Notifier', 'relay', intval($item_id)]); $DR->addto_update('relayed'); -- cgit v1.2.3