From 1e282ee5d0b5da425901676827332d4c857f2a3a Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Mon, 19 Dec 2022 17:04:47 -0800 Subject: [PATCH] ConversationView: Pull various functions out of getMessageActions --- ts/components/MyStories.stories.tsx | 2 +- ts/components/MyStories.tsx | 12 +- ts/components/Stories.stories.tsx | 2 +- ts/components/Stories.tsx | 6 +- ts/components/StoryViewer.stories.tsx | 2 +- ts/components/StoryViewer.tsx | 12 +- ts/components/StoryViewsNRepliesModal.tsx | 1 - ts/components/ToastCannotOpenGiftBadge.tsx | 24 --- ts/components/ToastManager.stories.tsx | 35 ++++ ts/components/ToastManager.tsx | 36 ++++ ts/components/ToastReactionFailed.stories.tsx | 28 --- ts/components/ToastReactionFailed.tsx | 15 -- .../ToastTapToViewExpiredIncoming.stories.tsx | 28 --- .../ToastTapToViewExpiredIncoming.tsx | 22 --- .../ToastTapToViewExpiredOutgoing.stories.tsx | 28 --- .../ToastTapToViewExpiredOutgoing.tsx | 22 --- ts/components/conversation/Message.tsx | 37 ++-- .../conversation/MessageDetail.stories.tsx | 2 - ts/components/conversation/MessageDetail.tsx | 19 +- ts/components/conversation/Quote.stories.tsx | 4 +- .../conversation/Timeline.stories.tsx | 7 +- ts/components/conversation/Timeline.tsx | 125 +++++-------- .../conversation/TimelineItem.stories.tsx | 5 +- ts/components/conversation/TimelineItem.tsx | 6 +- .../conversation/TimelineMessage.stories.tsx | 4 +- .../conversation/TimelineMessage.tsx | 14 +- .../UnsupportedMessage.stories.tsx | 2 - .../conversation/UnsupportedMessage.tsx | 10 +- ts/state/ducks/composer.ts | 40 +++++ ts/state/ducks/conversations.ts | 166 +++++++++++++++++- ts/state/ducks/stories.ts | 28 ++- ts/state/ducks/toast.ts | 1 + ts/state/roots/createMessageDetail.tsx | 2 +- ts/state/smart/MessageDetail.tsx | 15 -- ts/state/smart/Stories.tsx | 11 +- ts/state/smart/StoryViewer.tsx | 11 +- ts/state/smart/Timeline.tsx | 41 ++--- ts/types/Toast.tsx | 5 + ts/util/retryDeleteForEveryone.ts | 55 ------ ts/util/retryMessageSend.ts | 12 -- ts/util/showToast.tsx | 14 -- ts/views/conversation_view.tsx | 99 ----------- 42 files changed, 440 insertions(+), 570 deletions(-) delete mode 100644 ts/components/ToastCannotOpenGiftBadge.tsx delete mode 100644 ts/components/ToastReactionFailed.stories.tsx delete mode 100644 ts/components/ToastReactionFailed.tsx delete mode 100644 ts/components/ToastTapToViewExpiredIncoming.stories.tsx delete mode 100644 ts/components/ToastTapToViewExpiredIncoming.tsx delete mode 100644 ts/components/ToastTapToViewExpiredOutgoing.stories.tsx delete mode 100644 ts/components/ToastTapToViewExpiredOutgoing.tsx delete mode 100644 ts/util/retryDeleteForEveryone.ts delete mode 100644 ts/util/retryMessageSend.ts diff --git a/ts/components/MyStories.stories.tsx b/ts/components/MyStories.stories.tsx index c006cd086..8d916eff8 100644 --- a/ts/components/MyStories.stories.tsx +++ b/ts/components/MyStories.stories.tsx @@ -49,7 +49,7 @@ export default { queueStoryDownload: { action: true, }, - retrySend: { + retryMessageSend: { action: true, }, viewStory: { action: true }, diff --git a/ts/components/MyStories.tsx b/ts/components/MyStories.tsx index 5c9b82674..f73c95e3a 100644 --- a/ts/components/MyStories.tsx +++ b/ts/components/MyStories.tsx @@ -27,7 +27,7 @@ export type PropsType = { onForward: (storyId: string) => unknown; onSave: (story: StoryViewType) => unknown; queueStoryDownload: (storyId: string) => unknown; - retrySend: (messageId: string) => unknown; + retryMessageSend: (messageId: string) => unknown; viewStory: ViewStoryActionCreatorType; hasViewReceiptSetting: boolean; }; @@ -40,7 +40,7 @@ export function MyStories({ onForward, onSave, queueStoryDownload, - retrySend, + retryMessageSend, viewStory, hasViewReceiptSetting, }: PropsType): JSX.Element { @@ -95,7 +95,7 @@ export function MyStories({ onForward={onForward} onSave={onSave} queueStoryDownload={queueStoryDownload} - retrySend={retrySend} + retryMessageSend={retryMessageSend} setConfirmDeleteStory={setConfirmDeleteStory} story={story} viewStory={viewStory} @@ -120,7 +120,7 @@ type StorySentPropsType = Pick< | 'onForward' | 'onSave' | 'queueStoryDownload' - | 'retrySend' + | 'retryMessageSend' | 'viewStory' > & { setConfirmDeleteStory: (_: StoryViewType | undefined) => unknown; @@ -133,7 +133,7 @@ function StorySent({ onForward, onSave, queueStoryDownload, - retrySend, + retryMessageSend, setConfirmDeleteStory, story, viewStory, @@ -155,7 +155,7 @@ function StorySent({ sendStatus === ResolvedSendStatus.PartiallySent) ) { setWasManuallyRetried(true); - retrySend(story.messageId); + retryMessageSend(story.messageId); return; } diff --git a/ts/components/Stories.stories.tsx b/ts/components/Stories.stories.tsx index 7ec82c000..c76e0f978 100644 --- a/ts/components/Stories.stories.tsx +++ b/ts/components/Stories.stories.tsx @@ -45,7 +45,7 @@ export default { }, queueStoryDownload: { action: true }, renderStoryCreator: { action: true }, - retrySend: { action: true }, + retryMessageSend: { action: true }, showConversation: { action: true }, showStoriesSettings: { action: true }, showToast: { action: true }, diff --git a/ts/components/Stories.tsx b/ts/components/Stories.tsx index 1a7c7185c..1dc829160 100644 --- a/ts/components/Stories.tsx +++ b/ts/components/Stories.tsx @@ -42,7 +42,7 @@ export type PropsType = { preferredWidthFromStorage: number; queueStoryDownload: (storyId: string) => unknown; renderStoryCreator: () => JSX.Element; - retrySend: (messageId: string) => unknown; + retryMessageSend: (messageId: string) => unknown; setAddStoryData: (data: AddStoryData) => unknown; showConversation: ShowConversationType; showStoriesSettings: () => unknown; @@ -70,7 +70,7 @@ export function Stories({ preferredWidthFromStorage, queueStoryDownload, renderStoryCreator, - retrySend, + retryMessageSend, setAddStoryData, showConversation, showStoriesSettings, @@ -111,7 +111,7 @@ export function Stories({ onForward={onForwardStory} onSave={onSaveStory} queueStoryDownload={queueStoryDownload} - retrySend={retrySend} + retryMessageSend={retryMessageSend} viewStory={viewStory} /> ) : ( diff --git a/ts/components/StoryViewer.stories.tsx b/ts/components/StoryViewer.stories.tsx index f17947711..aeecb86f6 100644 --- a/ts/components/StoryViewer.stories.tsx +++ b/ts/components/StoryViewer.stories.tsx @@ -56,7 +56,7 @@ export default { }, queueStoryDownload: { action: true }, renderEmojiPicker: { action: true }, - retrySend: { action: true }, + retryMessageSend: { action: true }, showToast: { action: true }, skinTone: { defaultValue: 0, diff --git a/ts/components/StoryViewer.tsx b/ts/components/StoryViewer.tsx index 804d50590..57d17304a 100644 --- a/ts/components/StoryViewer.tsx +++ b/ts/components/StoryViewer.tsx @@ -101,7 +101,7 @@ export type PropsType = { recentEmojis?: Array; renderEmojiPicker: (props: RenderEmojiPickerProps) => JSX.Element; replyState?: ReplyStateType; - retrySend: (messageId: string) => unknown; + retryMessageSend: (messageId: string) => unknown; saveAttachment: SaveAttachmentActionCreatorType; setHasAllStoriesUnmuted: (isUnmuted: boolean) => unknown; showToast: ShowToastActionCreatorType; @@ -153,7 +153,7 @@ export function StoryViewer({ recentEmojis, renderEmojiPicker, replyState, - retrySend, + retryMessageSend, saveAttachment, setHasAllStoriesUnmuted, showToast, @@ -555,7 +555,7 @@ export function StoryViewer({ ]; } - function doRetrySend() { + function doRetryMessageSend() { if (wasManuallyRetried) { return; } @@ -568,7 +568,7 @@ export function StoryViewer({ } setWasManuallyRetried(true); - retrySend(messageId); + retryMessageSend(messageId); } return ( @@ -800,7 +800,7 @@ export function StoryViewer({ {sendStatus === ResolvedSendStatus.Failed && !wasManuallyRetried && (