Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
chg(list): sort notif stacks by time only (#1518)
Seamus74dc7bba61e3
diff --git a/js/app/packages/notifications/notification-stacking.ts b/js/app/packages/notifications/notification-stacking.tsindex 998e1c5e85..04aeb88234 100644--- a/js/app/packages/notifications/notification-stacking.ts+++ b/js/app/packages/notifications/notification-stacking.ts@@ -93,16 +93,13 @@ export function stackNotifications(...others.flatMap((n) => makeStack(n.notification_metadata.tag, [n])),];- // Sort: mentions first, then by recency- return groups.sort((a, b) => {- if ((a.type === 'channel_mention') !== (b.type === 'channel_mention')) {- return a.type === 'channel_mention' ? -1 : 1;- }- return compareDateDesc(+ // Sort by newest notification in each stack+ return groups.sort((a, b) =>+ compareDateDesc(a.notifications[0].created_at,b.notifications[0].created_at- );- });+ )+ );}function sortByRecency(items: UnifiedNotification[]): UnifiedNotification[] {diff --git a/js/app/packages/notifications/tests/notification-stacking.test.ts b/js/app/packages/notifications/tests/notification-stacking.test.tsindex 53e3886b02..c01ef69037 100644--- a/js/app/packages/notifications/tests/notification-stacking.test.ts+++ b/js/app/packages/notifications/tests/notification-stacking.test.ts@@ -199,7 +199,7 @@ describe('stackNotifications', () => {});describe('sorting', () => {- it('sorts mentions first', () => {+ it('sorts stacks by newest notification first', () => {const notifications = [createNewMessageNotification('n1', 'msg-1', 5000), // Most recent overallcreateMentionNotification('m1', 'msg-2', 1000), // Oldest@@ -208,8 +208,8 @@ describe('stackNotifications', () => {const result = stackNotifications(notifications);expect(result).toHaveLength(2);- expect(result[0].type).toBe('channel_mention'); // Mention first despite being older- expect(result[1].type).toBe('channel_message_send');+ expect(result[0].type).toBe('channel_message_send'); // Most recent first+ expect(result[1].type).toBe('channel_mention');});it('sorts non-mention groups by timestamp descending', () => {@@ -253,7 +253,7 @@ describe('stackNotifications', () => {expect(newMessages).toHaveLength(1);expect(replies).toHaveLength(2);- // Check mentions come first+ // Check ordering by recency (mentions are newest in this scenario)expect(result[0].type).toBe('channel_mention');expect(result[1].type).toBe('channel_mention');