diff options
-rw-r--r-- | Zotlabs/Module/Moderate.php | 14 | ||||
-rwxr-xr-x | include/items.php | 4 |
2 files changed, 16 insertions, 2 deletions
diff --git a/Zotlabs/Module/Moderate.php b/Zotlabs/Module/Moderate.php index cf1625a6b..b4709f3bd 100644 --- a/Zotlabs/Module/Moderate.php +++ b/Zotlabs/Module/Moderate.php @@ -52,6 +52,20 @@ class Moderate extends \Zotlabs\Web\Controller { intval(local_channel()), intval($post_id) ); + + // update the parent's commented timestamp + + $z = q("select max(created) as commented from item where parent_mid = '%s' and uid = %d and item_delayed = 0 ", + dbesc($r[0]['parent_mid']), + intval(local_channel()) + ); + + q("UPDATE item set commented = '%s', changed = '%s' WHERE id = %d", + dbesc(($z) ? $z[0]['commented'] : (datetime_convert())), + dbesc(datetime_convert()), + intval($r[0]['parent']) + ); + notice( t('Comment approved') . EOL); } elseif($action === 'drop') { diff --git a/include/items.php b/include/items.php index 7faa1b9ec..53d1a3c02 100755 --- a/include/items.php +++ b/include/items.php @@ -1977,11 +1977,11 @@ function item_store($arr, $allow_exec = false, $deliver = true) { */ call_hooks('post_remote_end', $arr); - // update the commented timestamp on the parent - unless this is potentially a clone of an older item + // update the commented timestamp on the parent - unless this is a moderated comment or a potential clone of an older item // which we don't wish to bring to the surface. As the queue only holds deliveries for 3 days, it's // suspected of being an older cloned item if the creation time is older than that. - if($arr['created'] > datetime_convert('','','now - 4 days')) { + if((intval($arr['item_blocked']) != ITEM_MODERATED) || ($arr['created'] > datetime_convert('','','now - 4 days'))) { $z = q("select max(created) as commented from item where parent_mid = '%s' and uid = %d and item_delayed = 0 ", dbesc($arr['parent_mid']), intval($arr['uid']) |