mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
avoid to show notification if disabled by user
Former-commit-id: d00b09c9e608c51223f7192ad85408976fac5baa
This commit is contained in:
parent
37f6da9aa8
commit
bb83f4ba4a
@ -96,6 +96,10 @@ if (get_parameter('check_new_notifications', 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (messages_get_count() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$messages = messages_get_overview(
|
||||
'timestamp',
|
||||
'ASC',
|
||||
|
@ -365,9 +365,16 @@ function messages_get_count(
|
||||
if ($ignore_source === true) {
|
||||
$source_sql = '';
|
||||
} else {
|
||||
$source_sql = 'INNER JOIN tnotification_source ns
|
||||
ON tm.id_source = ns.id
|
||||
AND ns.enabled = 1';
|
||||
$source_sql = sprintf(
|
||||
'INNER JOIN tnotification_source ns
|
||||
ON tm.id_source = ns.id
|
||||
AND ns.enabled = 1
|
||||
INNER JOIN tnotification_source_user nsu
|
||||
ON nsu.id_source=ns.id
|
||||
AND nsu.enabled = 1
|
||||
AND nsu.id_user = "%s"',
|
||||
$user
|
||||
);
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
@ -478,7 +485,11 @@ function messages_get_overview(
|
||||
if ($incl_source_info) {
|
||||
$source_fields = ', tns.*';
|
||||
$source_join = 'INNER JOIN tnotification_source tns
|
||||
ON tns.id=tm.id_source';
|
||||
ON tns.id=tm.id_source
|
||||
INNER JOIN tnotification_source_user nsu
|
||||
ON nsu.id_source=tns.id
|
||||
AND nsu.enabled = 1
|
||||
OR tns.enabled = 1';
|
||||
}
|
||||
|
||||
// Using distinct because could be double assignment due group/user.
|
||||
|
@ -525,7 +525,7 @@ function notifications_build_user_enable_return($status, $enabled)
|
||||
function notifications_get_user_label_status($source, $user, $label)
|
||||
{
|
||||
// If not enabled, it cannot be modificable.
|
||||
if (!$source['enabled'] || !$source[$label]) {
|
||||
if (!$source['enabled']) {
|
||||
return notifications_build_user_enable_return(false, false);
|
||||
}
|
||||
|
||||
@ -551,7 +551,10 @@ function notifications_get_user_label_status($source, $user, $label)
|
||||
);
|
||||
// No group found, return no permissions.
|
||||
$value = empty($common_groups) ? false : $source[$label];
|
||||
return notifications_build_user_enable_return($value, false);
|
||||
return notifications_build_user_enable_return(
|
||||
$value,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -570,7 +573,6 @@ function notifications_set_user_label_status($source, $user, $label, $value)
|
||||
$source_info = notifications_get_all_sources(['id' => $source]);
|
||||
if (!isset($source_info[0])
|
||||
|| !$source_info[0]['enabled']
|
||||
|| !$source_info[0][$label]
|
||||
|| !$source_info[0]['user_editable']
|
||||
) {
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user