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(fe-notifs): add metion info to create thread calls (#2695)

Seamus3ea903fbc06f
diff --git a/js/app/packages/block-md/comments/commentOperations.ts b/js/app/packages/block-md/comments/commentOperations.ts
index de7cfbb6f0..76f1756a76 100644
--- a/js/app/packages/block-md/comments/commentOperations.ts
+++ b/js/app/packages/block-md/comments/commentOperations.ts
@@ -43,7 +43,7 @@ export function useCreateComment() {
return createCallback(
async (info: CreateCommentRequest & { threadId: number }) => {
analytics.track('comment_create', { blockType: 'md' });
- const { threadId, text } = info;
+ const { threadId, text, mentions } = info;
if (threadId === -1) {
setActiveThread(threadId);
@@ -56,7 +56,11 @@ export function useCreateComment() {
let response: CreateCommentResponse | null = null;
- response = await createHighlightComment(text, comment.anchorId);
+ response = await createHighlightComment(
+ text,
+ comment.anchorId,
+ mentions
+ );
if (response) {
editor?.dispatchCommand(CREATE_COMMENT_COMMAND, {
diff --git a/js/app/packages/block-md/comments/commentsResource.ts b/js/app/packages/block-md/comments/commentsResource.ts
index 717a0844b4..ad40205e13 100644
--- a/js/app/packages/block-md/comments/commentsResource.ts
+++ b/js/app/packages/block-md/comments/commentsResource.ts
@@ -12,6 +12,7 @@ import type { AnnotationIncrementalUpdate } from '@service-storage/generated/sch
import type { Comment } from '@service-storage/generated/schemas/comment';
import type { CommentThread } from '@service-storage/generated/schemas/commentThread';
import type { CreateCommentRequest } from '@service-storage/generated/schemas/createCommentRequest';
+import type { CreateCommentRequestMentions } from '@service-storage/generated/schemas/createCommentRequestMentions';
import type { CreateCommentResponse } from '@service-storage/generated/schemas/createCommentResponse';
import type { DeleteCommentRequest } from '@service-storage/generated/schemas/deleteCommentRequest';
import type { DeleteCommentResponse } from '@service-storage/generated/schemas/deleteCommentResponse';
@@ -206,7 +207,11 @@ export function useDeleteCommentResource() {
export function useCreateHighlightCommentResource() {
const createComment = useCreateComment();
- return async (text: string, markId: MarkId) => {
+ return async (
+ text: string,
+ markId: MarkId,
+ mentions?: CreateCommentRequestMentions
+ ) => {
const metadata: ThreadMetadata = {
markId,
};
@@ -214,6 +219,7 @@ export function useCreateHighlightCommentResource() {
text: text,
threadId: undefined,
threadMetadata: metadata,
+ mentions,
};
return createComment(body);
diff --git a/js/app/packages/block-pdf/store/comments/commentOperations.ts b/js/app/packages/block-pdf/store/comments/commentOperations.ts
index 568d2ba3c3..af5214bf5e 100644
--- a/js/app/packages/block-pdf/store/comments/commentOperations.ts
+++ b/js/app/packages/block-pdf/store/comments/commentOperations.ts
@@ -36,7 +36,7 @@ export function useCreateComment() {
return createCallback(
async (info: CreateCommentRequest & { threadId: number }) => {
analytics.track('comment_create', { blockType: 'pdf' });
- const { threadId, text } = info;
+ const { threadId, text, mentions } = info;
// new thread + anchor
if (threadId === -1) {
@@ -56,9 +56,17 @@ export function useCreateComment() {
}
if (highlight.existsOnServer) {
- response = await attachHighlightComment(text, highlight.uuid);
+ response = await attachHighlightComment(
+ text,
+ highlight.uuid,
+ mentions
+ );
} else {
- response = await createHighlightComment(text, highlight);
+ response = await createHighlightComment(
+ text,
+ highlight,
+ mentions
+ );
}
break;
case 'free':
@@ -71,7 +79,11 @@ export function useCreateComment() {
return response;
}
- response = await createFreeComment(text, newThreadPlaceable_);
+ response = await createFreeComment(
+ text,
+ newThreadPlaceable_,
+ mentions
+ );
break;
default:
console.error('invalid comment type', comment.type);
diff --git a/js/app/packages/block-pdf/store/commentsResource.ts b/js/app/packages/block-pdf/store/commentsResource.ts
index 00630b075d..6fa0614fb8 100644
--- a/js/app/packages/block-pdf/store/commentsResource.ts
+++ b/js/app/packages/block-pdf/store/commentsResource.ts
@@ -16,6 +16,7 @@ import type { Comment } from '@service-storage/generated/schemas/comment';
import type { CommentThread } from '@service-storage/generated/schemas/commentThread';
import type { CreateCommentRequest } from '@service-storage/generated/schemas/createCommentRequest';
import type { CreateCommentRequestAnchor } from '@service-storage/generated/schemas/createCommentRequestAnchor';
+import type { CreateCommentRequestMentions } from '@service-storage/generated/schemas/createCommentRequestMentions';
import type { CreateCommentResponse } from '@service-storage/generated/schemas/createCommentResponse';
import type { CreateUnthreadedAnchorRequest } from '@service-storage/generated/schemas/createUnthreadedAnchorRequest';
import type { CreateUnthreadedAnchorResponse } from '@service-storage/generated/schemas/createUnthreadedAnchorResponse';
@@ -339,7 +340,11 @@ export function useDeleteCommentResource() {
export function useCreateFreeCommentResource() {
const createComment = useCreateComment();
- return async (text: string, placeable: IThreadPlaceable) => {
+ return async (
+ text: string,
+ placeable: IThreadPlaceable,
+ mentions?: CreateCommentRequestMentions
+ ) => {
let anchor: CreateCommentRequestAnchor | undefined;
if (placeable) {
anchor = {
@@ -366,6 +371,7 @@ export function useCreateFreeCommentResource() {
text: text,
threadId: undefined,
anchor,
+ mentions,
};
return createComment(body);
@@ -375,7 +381,11 @@ export function useCreateFreeCommentResource() {
export function useCreateHighlightCommentResource() {
const createComment = useCreateComment();
- return async (text: string, highlight: IHighlight) => {
+ return async (
+ text: string,
+ highlight: IHighlight,
+ mentions?: CreateCommentRequestMentions
+ ) => {
let anchor: CreateCommentRequestAnchor | undefined;
if (highlight) {
if (highlight.pageViewport == null) {
@@ -403,6 +413,7 @@ export function useCreateHighlightCommentResource() {
text: text,
threadId: undefined,
anchor,
+ mentions,
};
return createComment(body);
@@ -412,7 +423,11 @@ export function useCreateHighlightCommentResource() {
export function useAttachHighlightCommentResource() {
const createComment = useCreateComment();
- return async (text: string, uuid: string) => {
+ return async (
+ text: string,
+ uuid: string,
+ mentions?: CreateCommentRequestMentions
+ ) => {
const body: CreateCommentRequest = {
text: text,
threadId: undefined,
@@ -422,6 +437,7 @@ export function useAttachHighlightCommentResource() {
attachmentType: 'highlight',
uuid,
},
+ mentions,
};
return createComment(body);
diff --git a/js/app/packages/core/comments/Thread.tsx b/js/app/packages/core/comments/Thread.tsx
index 53ebac9b96..9213522a2d 100644
--- a/js/app/packages/core/comments/Thread.tsx
+++ b/js/app/packages/core/comments/Thread.tsx
@@ -1,4 +1,3 @@
-import { BozzyBracketInnerSibling } from '@core/component/BozzyBracket';
import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
import { createTheme } from '@core/component/LexicalMarkdown/theme';
import type { UserMentionRecord } from '@core/component/LexicalMarkdown/utils/mentionsUtils';
@@ -184,7 +183,7 @@ export function Thread(props: {
<div
// note: pdf-pointer-event-reset is a strange one-off class that mostly normalizes
// pointer-events: none vs. all inside the .pdfOverlayInner div.
- class="flex-shrink-0 bg-panel p-2 ring-1 ring-edge portal-scope pointer-events-auto pdf-pointer-event-reset"
+ class="flex-shrink-0 bg-panel p-2 ring-1 ring-edge-muted rounded-sm portal-scope pointer-events-auto pdf-pointer-event-reset"
classList={{
'transition-transform duration-100': true,
'-translate-x-8': props.isActive,
@@ -295,15 +294,6 @@ export function Thread(props: {
</Show>
</Show>
</div>
- <BozzyBracketInnerSibling
- classList={{
- 'opacity-0': !props.isActive,
- 'transition-transform duration-100': true,
- 'scale-110': !props.isActive,
- 'scale-100': props.isActive,
- '-translate-x-8': props.isActive,
- }}
- />
</MeasureContainer>
</StaticMarkdownContext>
</ThreadContext.Provider>