Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(search): include channel messages in inbox signal search results (#3469)

gbirman3cfb7bc51170
diff --git a/js/app/packages/app/component/next-soup/filters/predicates.ts b/js/app/packages/app/component/next-soup/filters/predicates.ts
index 4e34a6249b..4721bb8fdc 100644
--- a/js/app/packages/app/component/next-soup/filters/predicates.ts
+++ b/js/app/packages/app/component/next-soup/filters/predicates.ts
@@ -1,4 +1,5 @@
import { PROPERTY_OPTION_IDS } from '@core/component/Properties/constants';
+import type { Entity } from '@core/types';
import {
type EntityData,
getTaskAssigneeIds,
@@ -10,6 +11,15 @@ import {
import { getTaskPriorityOptionId } from '@entity/utils/task-properties';
import { compositeEntity, type NotificationSource } from '@notifications';
+// Channel messages don't have their own notifications — they share the parent
+// channel's. Resolve to the channel entity for notification lookups.
+function notificationLookupEntity(entity: EntityData): Entity {
+ if (entity.type === 'channel_message') {
+ return { type: 'channel', id: entity.channelId };
+ }
+ return entity;
+}
+
/**
* Unread filter - entity has unread content.
*
@@ -23,7 +33,9 @@ export function unreadFilter(notificationSource: NotificationSource) {
return !entity.isRead;
}
const notifications =
- notificationSource.notificationsByEntity()[compositeEntity(entity)];
+ notificationSource.notificationsByEntity()[
+ compositeEntity(notificationLookupEntity(entity))
+ ];
return notifications?.some((n) => !n.viewed_at) ?? false;
};
@@ -41,7 +53,9 @@ export function notDoneFilter(notificationSource: NotificationSource) {
if (entity.type === 'email') return !entity.done;
const notifications =
- notificationSource.notificationsByEntity()[compositeEntity(entity)];
+ notificationSource.notificationsByEntity()[
+ compositeEntity(notificationLookupEntity(entity))
+ ];
return notifications?.some(({ done }) => !done);
};