From 87615366ce6380739e69a49d8e0d77bf29db6e5c Mon Sep 17 00:00:00 2001 From: Tsahi Matsliah Date: Tue, 4 Aug 2026 14:04:21 +0300 Subject: [PATCH 01/12] feat(composer): edit shared posts in the new composer Editing a shared link still opened the old /posts/[id]/edit page: the menu only routed freeform and welcome posts to SmartComposerModal, and the modal forced kind to 'text' whenever editPost was set, so it could not represent a share at all. - Derive the kind from editPost.type, prefill the commentary the way the old page did (a share with no commentary carries the shared post's own title, which is not the author's text), and seed the preview from the post rather than refetching it - Lock the URL while editing: only the commentary is editable, matching what the API accepts - Add the missing edit branch to submitLink, including the moderation path, which completes without a toast of its own - Route share posts to the modal; moderation items keep the page, which edits a pending submission the composer cannot represent - Delete CreateLiveRoomForm and CreatePoll, referenced by nothing Co-Authored-By: Claude Fable 5 --- .../liveRooms/CreateLiveRoomForm.spec.tsx | 192 ---------- .../liveRooms/CreateLiveRoomForm.tsx | 345 ------------------ .../modals/post/SmartComposerModal.spec.tsx | 79 ++++ .../modals/post/SmartComposerModal.tsx | 54 ++- .../post/composer/LinkForm.spec.tsx | 41 ++- .../src/components/post/composer/LinkForm.tsx | 88 +++-- .../post/composer/useComposerSubmit.spec.tsx | 108 ++++++ .../post/composer/useComposerSubmit.ts | 21 +- .../src/components/post/poll/CreatePoll.tsx | 152 -------- .../src/features/posts/PostOptionButton.tsx | 6 +- 10 files changed, 352 insertions(+), 734 deletions(-) delete mode 100644 packages/shared/src/components/liveRooms/CreateLiveRoomForm.spec.tsx delete mode 100644 packages/shared/src/components/liveRooms/CreateLiveRoomForm.tsx create mode 100644 packages/shared/src/components/post/composer/useComposerSubmit.spec.tsx delete mode 100644 packages/shared/src/components/post/poll/CreatePoll.tsx diff --git a/packages/shared/src/components/liveRooms/CreateLiveRoomForm.spec.tsx b/packages/shared/src/components/liveRooms/CreateLiveRoomForm.spec.tsx deleted file mode 100644 index 3fa07f4174f..00000000000 --- a/packages/shared/src/components/liveRooms/CreateLiveRoomForm.spec.tsx +++ /dev/null @@ -1,192 +0,0 @@ -import { fireEvent, render, screen, waitFor } from '@testing-library/react'; -import React from 'react'; -import { CreateLiveRoomForm } from './CreateLiveRoomForm'; -import { LiveRoomMode } from '../../graphql/liveRooms'; - -const mockCreateLiveRoom = jest.fn(); -const mockDisplayToast = jest.fn(); -const mockLogEvent = jest.fn(); -const mockUseAuthContext = jest.fn(); - -jest.mock('../../hooks/liveRooms/useCreateLiveRoom', () => ({ - useCreateLiveRoom: () => ({ - mutateAsync: mockCreateLiveRoom, - isPending: false, - }), -})); - -jest.mock('../../hooks/useToastNotification', () => ({ - useToastNotification: () => ({ displayToast: mockDisplayToast }), -})); - -jest.mock('../fields/RichTextInput', () => ({ - __esModule: true, - default: ({ - initialContent, - maxInputLength, - onValueUpdate, - textareaProps, - }: { - initialContent?: string; - maxInputLength?: number; - onValueUpdate?: (value: string) => void; - textareaProps?: React.TextareaHTMLAttributes; - }) => ( -