mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
webui: Add ability to mark all notifications as read (#7489)
* feature: Add ability to mark all notifications as read fixes: https://community.librenms.org/t/ability-to-mark-all-notifications-as-re ad/2368/1 * Do not add multiple read notifications_attribs * not archive, yes non-admin * Oops, hardcoded user_id
This commit is contained in:
committed by
Tony Murray
parent
d362cd3368
commit
461b39e989
@@ -41,6 +41,12 @@ if (isset($_REQUEST['notification_id']) && isset($_REQUEST['action'])) {
|
||||
$status = 'ok';
|
||||
$message = 'Created';
|
||||
}
|
||||
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'read-all-notif') {
|
||||
foreach (dbFetchRows("SELECT `notifications_id` FROM `notifications` LEFT JOIN `notifications_attribs` A USING (`notifications_id`) WHERE A.`notifications_id` IS NULL OR (`user_id`=? AND NOT (`key`='read' AND `value`=1))", array($_SESSION['user_id'])) as $notifications) {
|
||||
dbInsert(array('notifications_id'=>$notifications['notifications_id'],'user_id'=>$_SESSION['user_id'],'key'=>'read','value'=>1), 'notifications_attribs');
|
||||
}
|
||||
$status = 'ok';
|
||||
$message = 'All notifications set as read';
|
||||
} else {
|
||||
$status = 'error';
|
||||
$message = 'ERROR: Missing Params';
|
||||
|
Reference in New Issue
Block a user