diff options
author | Mario <mario@mariovavti.com> | 2021-05-28 09:58:18 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-05-28 09:58:18 +0000 |
commit | 19bb96121b852d9bb3eb879cd7fe903e77805c4a (patch) | |
tree | 7508a80fcee129d3900c922c702ffc06b1defaa6 /Zotlabs/Module | |
parent | 69ef7cf1680cebed3512e918de30c09ac9ce0be4 (diff) | |
download | volse-hubzilla-19bb96121b852d9bb3eb879cd7fe903e77805c4a.tar.gz volse-hubzilla-19bb96121b852d9bb3eb879cd7fe903e77805c4a.tar.bz2 volse-hubzilla-19bb96121b852d9bb3eb879cd7fe903e77805c4a.zip |
move mark notifications read code to mod notifications
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Notifications.php | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/Zotlabs/Module/Notifications.php b/Zotlabs/Module/Notifications.php index 8ecf5760a..c08628b47 100644 --- a/Zotlabs/Module/Notifications.php +++ b/Zotlabs/Module/Notifications.php @@ -8,10 +8,58 @@ class Notifications extends \Zotlabs\Web\Controller { function get() { if(! local_channel()) { - notice( t('Permission denied.') . EOL); return; } + // ajax mark all unseen items read + if(x($_REQUEST, 'markRead')) { + switch($_REQUEST['markRead']) { + case 'dm': + $r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND item_unseen = 1 AND item_private = 2", + intval(local_channel()) + ); + break; + case 'network': + $r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND item_unseen = 1 AND item_private IN (0, 1)", + intval(local_channel()) + ); + break; + case 'home': + $r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND item_unseen = 1 AND item_wall = 1 AND item_private IN (0, 1)", + intval(local_channel()) + ); + break; + case 'all_events': + $evdays = intval(get_pconfig(local_channel(), 'system', 'evdays', 3)); + $r = q("UPDATE event SET dismissed = 1 WHERE uid = %d AND dismissed = 0 AND dtstart < '%s' AND dtstart > '%s' ", + intval(local_channel()), + dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')), + dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days')) + ); + break; + case 'notify': + $r = q("UPDATE notify SET seen = 1 WHERE seen = 0 AND uid = %d", + intval(local_channel()) + ); + break; + case 'pubs': + unset($_SESSION['static_loadtime']); + break; + default: + break; + } + killme(); + } + + // ajax mark all comments of a parent item read + if(x($_REQUEST, 'markItemRead') && local_channel()) { + $r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND parent = %d", + intval(local_channel()), + intval($_REQUEST['markItemRead']) + ); + killme(); + } + nav_set_selected('Notifications'); $o = ''; |