mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-01-18 16:17:26 +01:00
Remove modified
This commit is contained in:
@@ -70,7 +70,6 @@
|
||||
"notifications_delete": "Delete",
|
||||
"notifications_copied_to_clipboard": "Copied to clipboard",
|
||||
"notifications_tags": "Tags",
|
||||
"notifications_modified": "modified {{date}}",
|
||||
"notifications_priority_x": "Priority {{priority}}",
|
||||
"notifications_new_indicator": "New notification",
|
||||
"notifications_attachment_image": "Attachment image",
|
||||
|
||||
@@ -175,31 +175,16 @@ class SubscriptionManager {
|
||||
}
|
||||
|
||||
// Collapse notification updates based on sids, keeping only the latest version
|
||||
// Also tracks the original time (earliest) for each sequence
|
||||
groupNotificationsBySID(notifications) {
|
||||
const latestBySid = {};
|
||||
const originalTimeBySid = {};
|
||||
|
||||
notifications.forEach((notification) => {
|
||||
const key = `${notification.subscriptionId}:${notification.sid}`;
|
||||
|
||||
// Track the latest notification for each sid (first one since sorted DESC)
|
||||
// Keep only the first (latest by time) notification for each sid
|
||||
if (!(key in latestBySid)) {
|
||||
latestBySid[key] = notification;
|
||||
}
|
||||
|
||||
// Track the original (earliest) time for each sid
|
||||
const currentOriginal = originalTimeBySid[key];
|
||||
if (currentOriginal === undefined || notification.time < currentOriginal) {
|
||||
originalTimeBySid[key] = notification.time;
|
||||
}
|
||||
});
|
||||
|
||||
// Return latest notifications with originalTime set
|
||||
return Object.entries(latestBySid).map(([key, notification]) => ({
|
||||
...notification,
|
||||
originalTime: originalTimeBySid[key],
|
||||
}));
|
||||
return Object.values(latestBySid);
|
||||
}
|
||||
|
||||
/** Adds notification, or returns false if it already exists */
|
||||
|
||||
@@ -236,9 +236,7 @@ const NotificationItem = (props) => {
|
||||
const { t, i18n } = useTranslation();
|
||||
const { notification } = props;
|
||||
const { attachment } = notification;
|
||||
const isModified = notification.originalTime && notification.originalTime !== notification.time;
|
||||
const originalDate = formatShortDateTime(notification.originalTime || notification.time, i18n.language);
|
||||
const modifiedDate = isModified ? formatShortDateTime(notification.time, i18n.language) : null;
|
||||
const date = formatShortDateTime(notification.time, i18n.language);
|
||||
const otherTags = unmatchedTags(notification.tags);
|
||||
const tags = otherTags.length > 0 ? otherTags.join(", ") : null;
|
||||
const handleDelete = async () => {
|
||||
@@ -289,8 +287,7 @@ const NotificationItem = (props) => {
|
||||
</Tooltip>
|
||||
)}
|
||||
<Typography sx={{ fontSize: 14 }} color="text.secondary">
|
||||
{originalDate}
|
||||
{modifiedDate && ` (${t("notifications_modified", { date: modifiedDate })})`}
|
||||
{date}
|
||||
{[1, 2, 4, 5].includes(notification.priority) && (
|
||||
<img
|
||||
src={priorityFiles[notification.priority]}
|
||||
|
||||
Reference in New Issue
Block a user