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(references): fix channel message params, temp hide broken soup doc shared notifications (#1034)

Seamus4a264042bf49
diff --git a/js/app/packages/core/component/References.tsx b/js/app/packages/core/component/References.tsx
index 736d3a6679..ce9e720b6e 100644
--- a/js/app/packages/core/component/References.tsx
+++ b/js/app/packages/core/component/References.tsx
@@ -20,6 +20,7 @@ import { createMemo, createResource, For, Show } from 'solid-js';
import { InlineItemPreview } from './ItemPreview';
import { StaticMarkdown } from './LexicalMarkdown/component/core/StaticMarkdown';
import { UserIcon } from './UserIcon';
+import { URL_PARAMS as CHANNEL_PARAMS } from '@block-channel/constants';
export type ReferenceProps = {
documentId: string;
@@ -76,8 +77,8 @@ export function References(props: ReferenceProps) {
) => {
const blockHandle = await blockOrchestrator.getBlockHandle(channelId);
await blockHandle?.goToLocationFromParams({
- message_id: messageId,
- thread_id: threadId,
+ [CHANNEL_PARAMS.message]: messageId,
+ [CHANNEL_PARAMS.thread]: threadId,
});
};
diff --git a/js/app/packages/core/util/channels.ts b/js/app/packages/core/util/channels.ts
index 462378f039..4809815bde 100644
--- a/js/app/packages/core/util/channels.ts
+++ b/js/app/packages/core/util/channels.ts
@@ -12,6 +12,7 @@ import type {
SimpleMention,
} from '@service-comms/generated/models';
import { createCallback } from '@solid-primitives/rootless';
+import { URL_PARAMS as CHANNEL_PARAMS } from '@block-channel/constants';
type SendContent = {
content: string;
@@ -76,7 +77,7 @@ export function useSendMessageToPeople() {
});
const handle = await orchestrator.getBlockHandle(channelId);
await handle?.goToLocationFromParams({
- message_id: messageResponse.id,
+ [CHANNEL_PARAMS.message]: messageResponse.id,
});
};
diff --git a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
index 3f2d11a9bb..878b71c8b5 100644
--- a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
+++ b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
@@ -512,13 +512,29 @@ export function EntityWithEverything(
}
});
- const hasNotifications = () =>
- !!props.entity.notifications && props.entity.notifications().length > 0;
+ /**
+ * TODO (seamus + teo) : These notifications are being attached to the wrong
+ * entity - ie the channel and not the document being shared. this means
+ * we have notification rows that point to a channel but do not have a
+ * message_id to link to. These notifications result in 2 notifications
+ * on a channel when an item is shared. One for the message, and this
+ * weird busted one. Needs to be fixed in the service, then I will delete
+ * this logic.
+ */
+ const validNotifications = () => {
+ return (
+ props.entity.notifications?.().filter((notification) => {
+ return (
+ notification.notificationEventType !== 'channel_message_document'
+ );
+ }) ?? []
+ );
+ };
+
+ const hasNotifications = () => validNotifications().length > 0;
const notDoneNotifications = () => {
- const notifications = props.entity.notifications?.();
- if (!notifications) return [];
- return notifications.filter(({ done }) => !done);
+ return validNotifications().filter(({ done }) => !done);
};
const isSearch = createMemo(