aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Notify.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-09-18 18:06:32 +0000
committerMario <mario@mariovavti.com>2021-09-18 18:06:32 +0000
commit5497adfde6e1df941d42bb8fb6e18b261402716e (patch)
tree6f6f0839ed5e6ba6bd5e67942c328811d76fbb67 /Zotlabs/Module/Notify.php
parentd4c2e502858dd43672e7a24b41f3533fbbc18bdf (diff)
downloadvolse-hubzilla-5497adfde6e1df941d42bb8fb6e18b261402716e.tar.gz
volse-hubzilla-5497adfde6e1df941d42bb8fb6e18b261402716e.tar.bz2
volse-hubzilla-5497adfde6e1df941d42bb8fb6e18b261402716e.zip
add option to mark all notices of a thread read if a notice of the thread is clicked (default 1) and fix a php error in find_parent() if $act->obj is not an array
Diffstat (limited to 'Zotlabs/Module/Notify.php')
-rw-r--r--Zotlabs/Module/Notify.php28
1 files changed, 22 insertions, 6 deletions
diff --git a/Zotlabs/Module/Notify.php b/Zotlabs/Module/Notify.php
index 5bfcec4f7..4cbcfee05 100644
--- a/Zotlabs/Module/Notify.php
+++ b/Zotlabs/Module/Notify.php
@@ -1,19 +1,35 @@
<?php
namespace Zotlabs\Module;
+use \Zotlabs\Lib\PConfig;
+use \Zotlabs\Web\Controller;
-
-class Notify extends \Zotlabs\Web\Controller {
+class Notify extends Controller {
function init() {
if(! local_channel())
return;
if($_REQUEST['notify_id']) {
- q("update notify set seen = 1 where id = %d and uid = %d",
- intval($_REQUEST['notify_id']),
- intval(local_channel())
- );
+ $update_notices_per_parent = PConfig::Get(local_channel(), 'system', 'update_notices_per_parent', 1);
+
+ if($update_notices_per_parent) {
+ $r = q("SELECT parent FROM notify WHERE id = %d AND uid = %d",
+ intval($_REQUEST['notify_id']),
+ intval(local_channel())
+ );
+ q("update notify set seen = 1 where parent = '%s' and uid = %d",
+ dbesc($r[0]['parent']),
+ intval(local_channel())
+ );
+ }
+ else {
+ q("update notify set seen = 1 where id = %d and uid = %d",
+ intval($_REQUEST['notify_id']),
+ intval(local_channel())
+ );
+ }
+
killme();
}