aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
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
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')
-rw-r--r--Zotlabs/Module/Notify.php28
-rw-r--r--Zotlabs/Module/Settings/Channel.php9
2 files changed, 29 insertions, 8 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();
}
diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php
index 5732d2628..e95752338 100644
--- a/Zotlabs/Module/Settings/Channel.php
+++ b/Zotlabs/Module/Settings/Channel.php
@@ -216,7 +216,8 @@ class Channel {
if(x($_POST,'vnotify15'))
$vnotify += intval($_POST['vnotify15']);
- $always_show_in_notices = x($_POST,'always_show_in_notices') ? 1 : 0;
+ $always_show_in_notices = x($_POST, 'always_show_in_notices') ? 1 : 0;
+ $update_notices_per_parent = x($_POST, 'update_notices_per_parent') ? 1 : 0;
$err = '';
@@ -245,6 +246,7 @@ class Channel {
set_pconfig(local_channel(),'system','blocktags',$blocktags);
set_pconfig(local_channel(),'system','vnotify',$vnotify);
set_pconfig(local_channel(),'system','always_show_in_notices',$always_show_in_notices);
+ set_pconfig(local_channel(),'system','update_notices_per_parent',$update_notices_per_parent);
set_pconfig(local_channel(),'system','evdays',$evdays);
set_pconfig(local_channel(),'system','photo_path',$photo_path);
set_pconfig(local_channel(),'system','attach_path',$attach_path);
@@ -477,8 +479,10 @@ class Channel {
$perm_roles = \Zotlabs\Access\PermissionRoles::roles();
- $vnotify = get_pconfig(local_channel(),'system','vnotify');
$always_show_in_notices = get_pconfig(local_channel(),'system','always_show_in_notices');
+ $update_notices_per_parent = get_pconfig(local_channel(), 'system', 'update_notices_per_parent', 1);
+ $vnotify = get_pconfig(local_channel(),'system','vnotify');
+
if($vnotify === false)
$vnotify = (-1);
@@ -581,6 +585,7 @@ class Channel {
'$vnotify15' => array('vnotify15', t('Unseen forum posts'), ($vnotify & VNOTIFY_FORUMS), VNOTIFY_FORUMS, '', $yes_no),
'$mailhost' => [ 'mailhost', t('Email notification hub (hostname)'), get_pconfig(local_channel(),'system','email_notify_host',\App::get_hostname()), sprintf( t('If your channel is mirrored to multiple hubs, set this to your preferred location. This will prevent duplicate email notifications. Example: %s'),\App::get_hostname()) ],
'$always_show_in_notices' => array('always_show_in_notices', t('Show new wall posts, private messages and connections under Notices'), $always_show_in_notices, 1, '', $yes_no),
+ '$update_notices_per_parent' => array('update_notices_per_parent', t('Mark all notices of the thread read if a notice is clicked'), $update_notices_per_parent, 1, t('If no, only the clicked notice will be marked read'), $yes_no),
'$desktop_notifications_info' => t('Desktop notifications are unavailable because the required browser permission has not been granted'),
'$desktop_notifications_request' => t('Grant permission'),
'$evdays' => array('evdays', t('Notify me of events this many days in advance'), $evdays, t('Must be greater than 0')),