From c2952aa803cc7c7c03786b285e9f2b1f24b98c72 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 29 Jun 2023 11:29:48 +0000 Subject: make sure to not allow moderation of poll answers --- Zotlabs/Lib/Activity.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'Zotlabs/Lib/Activity.php') diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 48c99a0de..4a89842f2 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -2170,6 +2170,10 @@ class Activity { return false; } + if (intval($post['item_blocked']) === ITEM_MODERATED) { + return false; + } + dbq("START TRANSACTION"); $item = q("SELECT * FROM item WHERE id = %d FOR UPDATE", @@ -2945,6 +2949,12 @@ class Activity { // TODO: if we do not have a parent stop here and move the fetch to background? + if ($parent && $parent[0]['obj_type'] === 'Question') { + if ($item['obj_type'] === ACTIVITY_OBJ_COMMENT && $item['title'] && (!$item['body'])) { + $item['obj_type'] = 'Answer'; + } + } + if ($parent && $parent[0]['item_wall']) { // set the owner to the owner of the parent $item['owner_xchan'] = $parent[0]['owner_xchan']; @@ -2977,8 +2987,8 @@ class Activity { }*/ if (!$allowed) { - if (get_pconfig($channel['channel_id'], 'system', 'moderate_unsolicited_comments')) { - $item['item_blocked'] = intval(ITEM_MODERATED); + if (get_pconfig($channel['channel_id'], 'system', 'moderate_unsolicited_comments') && $item['obj_type'] !== 'Answer') { + $item['item_blocked'] = ITEM_MODERATED; $allowed = true; } else { @@ -3006,12 +3016,6 @@ class Activity { $allowed = false; } } - - if ($parent && $parent[0]['obj_type'] === 'Question') { - if ($item['obj_type'] === ACTIVITY_OBJ_COMMENT && $item['title'] && (!$item['body'])) { - $item['obj_type'] = 'Answer'; - } - } } else { -- cgit v1.2.3