about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-11-18 15:38:20 -0600
committerPaul Frazee <pfrazee@gmail.com>2022-11-18 15:38:20 -0600
commit39058cd36a9839df0e0c7e30ba486a09e30f169c (patch)
treefc522f4aabc56ac6a93de7e613245508e88d0fce /src
parente02b39bf84aa91354c84f7442929cb83d60e723e (diff)
downloadvoidsky-39058cd36a9839df0e0c7e30ba486a09e30f169c.tar.zst
Dont group notifications that are an hour apart
Diffstat (limited to 'src')
-rw-r--r--src/state/models/notifications-view.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/state/models/notifications-view.ts b/src/state/models/notifications-view.ts
index d9ef8f877..76617c6db 100644
--- a/src/state/models/notifications-view.ts
+++ b/src/state/models/notifications-view.ts
@@ -8,6 +8,8 @@ import {cleanError} from '../../view/lib/strings'
 
 const UNGROUPABLE_REASONS = ['trend', 'assertion']
 
+const MS_60MIN = 1e3 * 60 * 60
+
 export interface GroupedNotification extends ListNotifications.Notification {
   additional?: ListNotifications.Notification[]
 }
@@ -344,10 +346,13 @@ function groupNotifications(
 ): GroupedNotification[] {
   const items2: GroupedNotification[] = []
   for (const item of items) {
+    const ts = +new Date(item.indexedAt)
     let grouped = false
     if (!UNGROUPABLE_REASONS.includes(item.reason)) {
       for (const item2 of items2) {
+        const ts2 = +new Date(item2.indexedAt)
         if (
+          Math.abs(ts2 - ts) < MS_60MIN &&
           item.reason === item2.reason &&
           item.reasonSubject === item2.reasonSubject &&
           item.author.did !== item2.author.did