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