diff options
author | Mario Vavti <mario@mariovavti.com> | 2024-10-09 18:17:37 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2024-10-09 18:17:37 +0200 |
commit | 45c0091d3d5ce1aae1f4915dfd4c15865a011fe1 (patch) | |
tree | 8a9c4dd92ca86a3ee0fec353de9b80f49aef3a2a /include/items.php | |
parent | 75184355d02007593d978a13b7e57514e6b08f63 (diff) | |
download | volse-hubzilla-45c0091d3d5ce1aae1f4915dfd4c15865a011fe1.tar.gz volse-hubzilla-45c0091d3d5ce1aae1f4915dfd4c15865a011fe1.tar.bz2 volse-hubzilla-45c0091d3d5ce1aae1f4915dfd4c15865a011fe1.zip |
more work on porting containers from streams
Diffstat (limited to 'include/items.php')
-rw-r--r-- | include/items.php | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/include/items.php b/include/items.php index fa699148a..60f5cbe9c 100644 --- a/include/items.php +++ b/include/items.php @@ -525,7 +525,7 @@ function post_activity_item($arr, $allow_code = false, $deliver = true, $channel $post = item_store($arr, $allow_code, $deliver, $addAndSync); -hz_syslog('xxx: ' . print_r($post, true)); + hz_syslog('post_activity_item: ' . print_r($post['item_id'], true)); if (!$post['success']) { return $ret; @@ -3395,6 +3395,9 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false if ($post_id) { Master::Summon([ 'Notifier','tgroup',$post_id ]); + if (!empty($post['approval_id'])) { + Master::Summon(['Notifier', 'tgroup', $post['approval_id']]); + } } q("update channel set channel_lastpost = '%s' where channel_id = %d", @@ -5181,10 +5184,12 @@ function addToCollectionAndSync($ret) { $channel = channelx_by_n($ret['item']['uid']); if ($channel && $channel['channel_hash'] === $ret['item']['owner_xchan']) { $items = [$ret['item']]; + if ((int)$items[0]['item_blocked'] === ITEM_MODERATED || (int)$items[0]['item_unpublished'] || (int)$items[0]['item_delayed']) { return $ret; } + xchan_query($items); $items = fetch_post_tags($items); $sync_items = []; @@ -5192,16 +5197,16 @@ function addToCollectionAndSync($ret) { if (!in_array($ret['item']['verb'], ['Add', 'Remove'])) { - $newObj = Activity::build_packet(Activity::encode_activity($items[0]), $channel, false); - $approval = Activity::addToCollection($channel, $newObj, $ret['item']['parent_mid'], $ret['item'], deliver: false); -//hz_syslog(print_r($approval, true)); + $new_obj = Activity::build_packet(Activity::encode_activity($items[0]), $channel, false); + $approval = Activity::addToCollection($channel, $new_obj, $ret['item']['parent_mid'], $ret['item'], deliver: false); + if ($approval['success']) { $ret['approval_id'] = $approval['item_id']; $ret['approval'] = $approval['activity']; - $addItems = [$approval['activity']]; - xchan_query($addItems); - $addItems = fetch_post_tags($addItems); - $sync_items[] = encode_item($addItems[0], true); + $add_items = [$approval['activity']]; + xchan_query($add_items); + $add_items = fetch_post_tags($add_items); + $sync_items[] = encode_item($add_items[0], true); } } @@ -5227,3 +5232,12 @@ function addToCollectionAndSync($ret) { return $ret; } + +function reverse_activity_mid($string) { + return str_replace(z_root() . '/activity/', z_root() . '/item/', $string); +} + +function set_activity_mid($string) { + return str_replace(z_root() . '/item/', z_root() . '/activity/', $string); +} + |