mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
Added update ball notifications
Former-commit-id: 60c253a1b64d1084ae732e88e0a6fb1f98cf8a12
This commit is contained in:
parent
1223ce69da
commit
17c012cd83
@ -425,7 +425,22 @@ config_check();
|
|||||||
"last_id": last_id
|
"last_id": last_id
|
||||||
},
|
},
|
||||||
function (data, status) {
|
function (data, status) {
|
||||||
// TODO
|
if(!data.has_new_notifications) return;
|
||||||
|
// Substitute the ball
|
||||||
|
var new_ball = atob(data.new_ball);
|
||||||
|
var ball_wrapper = document
|
||||||
|
.getElementById('notification-ball-header')
|
||||||
|
.parentElement;
|
||||||
|
if (ball_wrapper === null) {
|
||||||
|
console.error('Cannot update notification ball');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ball_wrapper.innerHTML = new_ball;
|
||||||
|
|
||||||
|
// Show the toasts
|
||||||
|
//TODO
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
"json"
|
"json"
|
||||||
)
|
)
|
||||||
|
@ -98,15 +98,20 @@ if (get_parameter('check_new_notifications', 0)) {
|
|||||||
$last_id_ui = (int) get_parameter('last_id', 0);
|
$last_id_ui = (int) get_parameter('last_id', 0);
|
||||||
$counters = notifications_get_counters();
|
$counters = notifications_get_counters();
|
||||||
if ((int) $last_id_ui === (int) $counters['last_id']) {
|
if ((int) $last_id_ui === (int) $counters['last_id']) {
|
||||||
echo json_encode(['new_notifications' => []]);
|
echo json_encode(['has_new_notifications' => false]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is new messages, get the info.
|
// If there is new messages, get the info.
|
||||||
echo json_encode(
|
echo json_encode(
|
||||||
[
|
[
|
||||||
'notifications' => $counters['notifications'],
|
'has_new_notifications' => true,
|
||||||
'last_id' => $counters['last_id'],
|
'new_ball' => base64_encode(
|
||||||
|
notifications_print_ball(
|
||||||
|
$counters['notifications'],
|
||||||
|
$counters['last_id']
|
||||||
|
)
|
||||||
|
),
|
||||||
'new_notifications' => messages_get_overview(
|
'new_notifications' => messages_get_overview(
|
||||||
'timestamp',
|
'timestamp',
|
||||||
'ASC',
|
'ASC',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user