mastogroups - support moderation

This commit is contained in:
nobody 2021-06-23 00:19:51 -07:00
parent efe8657cf2
commit 91f32b11ca
2 changed files with 17 additions and 1 deletions

View file

@ -91,6 +91,18 @@ class Moderate extends Controller {
Libsync::build_sync_packet(local_channel(),array('item' => array(encode_item($sync_item[0],true))));
}
if($action === 'approve') {
if ($item['id'] !== $item['parent']) {
// if this is a group comment, call tag_deliver() to generate the associated
// Announce activity so microblog destinations will see it in their home timeline
$role = get_pconfig(local_channel(),'system','permissions_role');
$rolesettings = PermissionRoles::role_perms($role);
$channel_type = isset($rolesettings['channel_type']) ? $rolesettings['channel_type'] : 'normal';
$is_group = (($channel_type === 'group') ? true : false);
if ($is_group) {
tag_deliver(local_channel(),$post_id);
}
}
Run::Summon( [ 'Notifier', 'comment-new', $post_id ] );
}
goaway(z_root() . '/moderate');

View file

@ -2691,7 +2691,7 @@ function tag_deliver($uid, $item_id) {
logger('check_item_source returns true');
}
// This might be a followup (e.g. comment) by the original post author to an already uplinked item
// This might be a followup (e.g. comment) to an already uplinked item
// If so setup a second delivery chain
if (! intval($item['item_thread_top'])) {
@ -2706,6 +2706,10 @@ function tag_deliver($uid, $item_id) {
if ($item['verb'] === 'Announce' && $item['author_xchan'] === $u['channel_hash']) {
return;
}
// don't boost moderated content until it has been approved
if(intval($item['item_blocked']) === ITEM_MODERATED) {
return;
}
logger('group_comment');
start_delivery_chain($u, $item, $item_id, $x[0], true, (($item['edited'] != $item['created']) || $item['item_deleted']));
}