aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Moderate.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-03-24 02:22:24 -0700
committerzotlabs <mike@macgirvin.com>2018-03-24 02:22:24 -0700
commit558e3f804247b14448969d8a0c8cf83b6c0fe4d7 (patch)
tree4105de5d9be9b7845178ba862276c13a0e1bfc79 /Zotlabs/Module/Moderate.php
parenta8d81a68d62e982094110a340341756fbb6df4a9 (diff)
downloadvolse-hubzilla-558e3f804247b14448969d8a0c8cf83b6c0fe4d7.tar.gz
volse-hubzilla-558e3f804247b14448969d8a0c8cf83b6c0fe4d7.tar.bz2
volse-hubzilla-558e3f804247b14448969d8a0c8cf83b6c0fe4d7.zip
code optimisations and de-duplication on updating parent commented timestamp
Diffstat (limited to 'Zotlabs/Module/Moderate.php')
-rw-r--r--Zotlabs/Module/Moderate.php17
1 files changed, 6 insertions, 11 deletions
diff --git a/Zotlabs/Module/Moderate.php b/Zotlabs/Module/Moderate.php
index b4709f3bd..10c8ab8f2 100644
--- a/Zotlabs/Module/Moderate.php
+++ b/Zotlabs/Module/Moderate.php
@@ -47,24 +47,17 @@ class Moderate extends \Zotlabs\Web\Controller {
);
if($r) {
+ $item = $r[0];
+
if($action === 'approve') {
q("update item set item_blocked = 0 where uid = %d and id = %d",
intval(local_channel()),
intval($post_id)
);
- // update the parent's commented timestamp
+ $item['item_blocked'] = 0;
- $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'])
- );
+ item_update_parent_commented($item);
notice( t('Comment approved') . EOL);
}
@@ -72,6 +65,8 @@ class Moderate extends \Zotlabs\Web\Controller {
drop_item($post_id,false);
notice( t('Comment deleted') . EOL);
}
+
+ // refetch the item after changes have been made
$r = q("select * from item where id = %d",
intval($post_id)