From d782a0214eb0bec9efaff33d40ec104e20817baa Mon Sep 17 00:00:00 2001 From: William Grant Date: Thu, 15 Jun 2023 16:52:52 +1000 Subject: [PATCH] feat: dont save interaction error messages in communities --- _locales/en/messages.json | 2 +- ts/components/conversation/SessionMessagesList.tsx | 1 + .../message/message-item/InteractionNotification.tsx | 7 ++++++- ts/interactions/conversationInteractions.ts | 5 +++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 0b8670750..53c93db9f 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -108,7 +108,7 @@ "hideConversationFailedPleaseTryAgain": "Unable to hide the conversation, please try again", "deleteConversation": "Delete Conversation", "deleteConversationConfirmation": "Are you sure you want to delete your conversation with $name$?", - "deleteConversationFailed": "Failed to leave the Conversation!", + "deleteConversationFailed": "Failed to delete the Conversation!", "deleteConversationFailedPleaseTryAgain": "Unable to delete the conversation, please try again", "hiding": "Hiding...", "leaving": "Leaving...", diff --git a/ts/components/conversation/SessionMessagesList.tsx b/ts/components/conversation/SessionMessagesList.tsx index 043d955e5..031035c63 100644 --- a/ts/components/conversation/SessionMessagesList.tsx +++ b/ts/components/conversation/SessionMessagesList.tsx @@ -120,6 +120,7 @@ export const SessionMessagesList = (props: { ) : null; const componentToMerge = [dateBreak, unreadIndicator]; + if (messageProps.message?.messageType === 'group-notification') { const msgProps = messageProps.message.props as PropsForGroupUpdate; return [, ...componentToMerge]; diff --git a/ts/components/conversation/message/message-item/InteractionNotification.tsx b/ts/components/conversation/message/message-item/InteractionNotification.tsx index 4b2626afb..855097fa0 100644 --- a/ts/components/conversation/message/message-item/InteractionNotification.tsx +++ b/ts/components/conversation/message/message-item/InteractionNotification.tsx @@ -24,8 +24,13 @@ export const InteractionNotification = (props: PropsForInteractionNotification) const isGroup = !useIsPrivate(convoId); const isCommunity = useIsPublic(convoId); - // NOTE For now we only show interaction errors in the message history + // NOTE at this time we don't show visible control messages in communities, that might change in future... + if (isCommunity) { + return null; + } + if (interactionStatus !== ConversationInteractionStatus.Error) { + // NOTE For now we only show interaction errors in the message history return null; } diff --git a/ts/interactions/conversationInteractions.ts b/ts/interactions/conversationInteractions.ts index e3ca0d086..901fbeffd 100644 --- a/ts/interactions/conversationInteractions.ts +++ b/ts/interactions/conversationInteractions.ts @@ -751,6 +751,11 @@ async function saveConversationInteractionErrorAsMessage({ status: interactionStatus, }); + // NOTE at this time we don't have visible control messages in communities + if (conversation.isPublic()) { + return; + } + // Add an error message to the database so we can view it in the message history await conversation?.addSingleIncomingMessage({ source: UserUtils.getOurPubKeyStrFromCache(),