#12156 fix notification group

This commit is contained in:
Jonathan 2023-12-20 15:14:16 +01:00
parent 2f7e6f4bec
commit 5194bd165c
1 changed files with 15 additions and 1 deletions

View File

@ -636,13 +636,15 @@ function notifications_get_user_label_status($source, $user, $label)
);
// Clean default common groups error for mesagges.
$group_enable = true;
if ($common_groups[0] === 0) {
unset($common_groups[0]);
$group_enable = false;
}
// 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, $group_enable);
}
@ -674,6 +676,18 @@ function notifications_set_user_label_status($source, $user, $label, $value)
return false;
}
$eixsts = db_get_row('tnotification_source_user', 'id_user', $user);
if ($eixsts === false) {
db_process_sql_insert(
'tnotification_source_user',
[
'id_user' => $user,
'id_source' => $source,
'enabled' => '1',
]
);
}
return (bool) db_process_sql_update(
'tnotification_source_user',
[$label => $value],