mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 00:04:37 +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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (messages_get_count() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$messages = messages_get_overview(
|
$messages = messages_get_overview(
|
||||||
'timestamp',
|
'timestamp',
|
||||||
'ASC',
|
'ASC',
|
||||||
|
@ -365,9 +365,16 @@ function messages_get_count(
|
|||||||
if ($ignore_source === true) {
|
if ($ignore_source === true) {
|
||||||
$source_sql = '';
|
$source_sql = '';
|
||||||
} else {
|
} else {
|
||||||
$source_sql = 'INNER JOIN tnotification_source ns
|
$source_sql = sprintf(
|
||||||
ON tm.id_source = ns.id
|
'INNER JOIN tnotification_source ns
|
||||||
AND ns.enabled = 1';
|
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(
|
$sql = sprintf(
|
||||||
@ -478,7 +485,11 @@ function messages_get_overview(
|
|||||||
if ($incl_source_info) {
|
if ($incl_source_info) {
|
||||||
$source_fields = ', tns.*';
|
$source_fields = ', tns.*';
|
||||||
$source_join = 'INNER JOIN tnotification_source 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.
|
// 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)
|
function notifications_get_user_label_status($source, $user, $label)
|
||||||
{
|
{
|
||||||
// If not enabled, it cannot be modificable.
|
// If not enabled, it cannot be modificable.
|
||||||
if (!$source['enabled'] || !$source[$label]) {
|
if (!$source['enabled']) {
|
||||||
return notifications_build_user_enable_return(false, false);
|
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.
|
// No group found, return no permissions.
|
||||||
$value = empty($common_groups) ? false : $source[$label];
|
$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]);
|
$source_info = notifications_get_all_sources(['id' => $source]);
|
||||||
if (!isset($source_info[0])
|
if (!isset($source_info[0])
|
||||||
|| !$source_info[0]['enabled']
|
|| !$source_info[0]['enabled']
|
||||||
|| !$source_info[0][$label]
|
|
||||||
|| !$source_info[0]['user_editable']
|
|| !$source_info[0]['user_editable']
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user