Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions apps/app/src/components/comments/CommentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,17 @@ export function CommentForm({ entityId, entityType, mentionResource, organizatio

// Check if comment has content
const hasContent = useCallback((content: JSONContent | null): boolean => {
if (!content || !content.content) return false;

// Check if there's any text content
const hasText = content.content.some((node) => {
if (node.type === 'paragraph' && node.content) {
return node.content.some((child) => {
if (child.type === 'text' && child.text?.trim()) return true;
if (child.type === 'mention') return true; // Mentions count as content
return false;
});
}
if (!content) return false;

const hasContentInNode = (node: JSONContent): boolean => {
if (node.type === 'mention') return true;
return false;
});
if (node.type === 'text' && node.text?.trim()) return true;

if (!node.content || node.content.length === 0) return false;
return node.content.some(hasContentInNode);
};

return hasText;
return hasContentInNode(content);
}, []);

const handleCommentSubmit = async () => {
Expand Down
Loading