From 9a6a54e2d6a6f7bff8ca5467c8a2680f4ad735fb Mon Sep 17 00:00:00 2001
From: winter
Date: Fri, 21 Mar 2025 21:29:53 +0000
Subject: add timestamps to notifications
---
templates/notification.php | 3 +++
templates/notifications_panel.php | 7 ++++---
2 files changed, 7 insertions(+), 3 deletions(-)
(limited to 'templates')
diff --git a/templates/notification.php b/templates/notification.php
index 0b105bd..0a54a6f 100644
--- a/templates/notification.php
+++ b/templates/notification.php
@@ -20,6 +20,9 @@
= htmlspecialchars($body, double_encode: false) ?>
+
+ = format_datetime($timestamp) ?>
+
_="
on load
set title to innerText of previous .title
diff --git a/templates/notifications_panel.php b/templates/notifications_panel.php
index 574a295..4a671b1 100644
--- a/templates/notifications_panel.php
+++ b/templates/notifications_panel.php
@@ -12,8 +12,8 @@ $notifications = Notification::findAllForUser($user, 50);
if (count($notifications) <= 0) {
call_template('placeholder_text');
}
- foreach ($notifications as $notif) {
- $notif = $notif->toNotifyable();
+ foreach ($notifications as $notification) {
+ $notif = $notification->toNotifyable();
if ($notif == null)
continue;
call_template('notification', [
@@ -21,7 +21,8 @@ $notifications = Notification::findAllForUser($user, 50);
'body' => $notif->getNotificationBody(),
'imageUrl' => $notif->getNotificationImageUrl(),
'titleLink' => $notif->getNotificationTitleLink(),
- 'imageLink' => $notif->getNotificationImageLink()
+ 'imageLink' => $notif->getNotificationImageLink(),
+ 'timestamp' => $notification->created
]);
}
?>
--
cgit v1.3