From 07a8151ae66f1ccf00017f521219afdc2f5370ec Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 20 Jun 2017 12:45:05 -0700 Subject: more anon comment fixes --- Zotlabs/Daemon/Notifier.php | 3 ++- Zotlabs/Lib/ThreadItem.php | 2 +- Zotlabs/Module/Moderate.php | 26 +++++++++++++------------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 0e7284793..20dd96ddd 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -268,7 +268,8 @@ class Notifier { // Check for non published items, but allow an exclusion for transmitting hidden file activities - if(intval($target_item['item_unpublished']) || intval($target_item['item_delayed']) || + if(intval($target_item['item_unpublished']) || intval($target_item['item_delayed']) || + intval($target_item['item_blocked']) || ( intval($target_item['item_hidden']) && ($target_item['obj_type'] !== ACTIVITY_OBJ_FILE))) { logger('notifier: target item not published, so not forwardable', LOGGER_DEBUG); return; diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 8ee35f988..72d8af4dd 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -743,7 +743,7 @@ class ThreadItem { '$cipher' => $conv->get_cipher(), '$sourceapp' => \App::$sourcename, '$observer' => get_observer_hash(), - '$anoncomments' => perm_is_allowed($conv->get_profile_owner(),'','post_comments'), + '$anoncomments' => (($conv->get_mode() === 'channel' && perm_is_allowed($conv->get_profile_owner(),'','post_comments')) ? true : false), '$anonname' => [ 'anonname', t('Your full name (required)'),'','' ], '$anonmail' => [ 'anonmail', t('Your email address (required)'),'','' ], '$anonurl' => [ 'anonurl', t('Your website URL (optional)'),'','' ] diff --git a/Zotlabs/Module/Moderate.php b/Zotlabs/Module/Moderate.php index b7f05e4b2..92df58858 100644 --- a/Zotlabs/Module/Moderate.php +++ b/Zotlabs/Module/Moderate.php @@ -28,8 +28,6 @@ class Moderate extends \Zotlabs\Web\Controller { intval(ITEM_MODERATED) ); - - if($r) { if($action === 'approve') { q("update item set item_blocked = 0 where uid = %d and id = %d", @@ -42,19 +40,21 @@ class Moderate extends \Zotlabs\Web\Controller { drop_item($post_id,false); notice( t('Comment deleted') . EOL); } + + $r = q("select * from item where id = %d", + intval($post_id) + ); + if($r) { + xchan_query($r); + $sync_item = fetch_post_tags($r); + build_sync_packet(local_channel(),array('item' => array(encode_item($sync_item[0],true)))); + } + if($action === 'approve') { + \Zotlabs\Daemon\Master::Summon(array('Notifier', 'comment-new', $post_id)); + } + goaway(z_root() . '/moderate'); } - - $r = q("select * from item where id = %d", - intval($post_id) - ); - if($r) { - xchan_query($r); - $sync_item = fetch_post_tags($r); - build_sync_packet(local_channel(),array('item' => array(encode_item($sync_item[0],true)))); - } - goaway(z_root() . '/moderate'); } - $r = q("select item.id as item_id, item.* from item where item.uid = %d and item_blocked = %d and item_deleted = 0 order by created desc limit 60", intval(local_channel()), intval(ITEM_MODERATED) -- cgit v1.2.3