From 5e3f968d22b0a817f1294935d91b5fcaff03f378 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Tue, 13 Feb 2024 12:15:25 +1100 Subject: [PATCH] fix: merge issues --- ts/components/SessionPasswordPrompt.tsx | 4 +-- .../header/ConversationHeaderTitle.tsx | 28 ------------------- .../overlay/OverlayRightPanelSettings.tsx | 22 +++++++-------- .../InteractionItem.tsx | 15 +++++----- ts/components/menu/Menu.tsx | 11 ++++---- ts/receiver/configMessage.ts | 1 + ts/state/ducks/metaGroups.ts | 4 +-- 7 files changed, 29 insertions(+), 56 deletions(-) diff --git a/ts/components/SessionPasswordPrompt.tsx b/ts/components/SessionPasswordPrompt.tsx index 929db35c8..e9d55c5fd 100644 --- a/ts/components/SessionPasswordPrompt.tsx +++ b/ts/components/SessionPasswordPrompt.tsx @@ -38,8 +38,8 @@ const StyledContent = styled.div` // We cannot import toastutils from the password window as it is pulling the whole sending // pipeline(and causing crashes on Session instances with password) -function pushToastError(id: string, title: string, description?: string) { - toast.error(, { +function pushToastError(id: string, description: string) { + toast.error(, { toastId: id, updateId: id, }); diff --git a/ts/components/conversation/header/ConversationHeaderTitle.tsx b/ts/components/conversation/header/ConversationHeaderTitle.tsx index eab052d05..85437e1f4 100644 --- a/ts/components/conversation/header/ConversationHeaderTitle.tsx +++ b/ts/components/conversation/header/ConversationHeaderTitle.tsx @@ -82,34 +82,6 @@ export const ConversationHeaderTitle = () => { return null; }, [i18n, isGroup, isKickedFromGroup, isPublic, selectedMembersCount, subscriberCount]); -<<<<<<< HEAD - // TODO legacy messages support will be removed in a future release - // NOTE If disappearing messages is defined we must show it first - const disappearingMessageSubtitle = useMemo(() => { - const disappearingMessageSettingText = - expirationMode === 'deleteAfterRead' - ? window.i18n('disappearingMessagesModeAfterRead') - : expirationMode === 'deleteAfterSend' - ? window.i18n('disappearingMessagesModeAfterSend') - : expirationMode === 'legacy' - ? isMe || (isGroup && !isPublic) - ? window.i18n('disappearingMessagesModeAfterSend') - : window.i18n('disappearingMessagesModeAfterRead') - : null; - - const abbreviatedExpireTime = isNumber(expireTimer) - ? TimerOptions.getAbbreviated(expireTimer) - : null; - - return expireTimer && disappearingMessageSettingText - ? `${disappearingMessageSettingText}${ - abbreviatedExpireTime ? ` - ${abbreviatedExpireTime}` : '' - }` - : null; - }, [expirationMode, expireTimer, isGroup, isMe, isPublic]); - -======= ->>>>>>> unstable const handleRightPanelToggle = () => { if (isRightPanelOn) { dispatch(closeRightPanel()); diff --git a/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx b/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx index 1d1e16f52..2a82716ba 100644 --- a/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx +++ b/ts/components/conversation/right-panel/overlay/OverlayRightPanelSettings.tsx @@ -41,15 +41,13 @@ import { AttachmentTypeWithPath } from '../../../../types/Attachment'; import { getAbsoluteAttachmentPath } from '../../../../types/MessageAttachment'; import { Avatar, AvatarSize } from '../../../avatar/Avatar'; import { Flex } from '../../../basic/Flex'; -import { SpacerMD } from '../../../basic/Text'; +import { SpacerLG, SpacerMD, SpacerXL } from '../../../basic/Text'; import { PanelButtonGroup, PanelIconButton } from '../../../buttons'; import { MediaItemType } from '../../../lightbox/LightboxGallery'; import { MediaGallery } from '../../media-gallery/MediaGallery'; import { Header, StyledScrollContainer } from './components'; -async function getMediaGalleryProps( - conversationId: string -): Promise<{ +async function getMediaGalleryProps(conversationId: string): Promise<{ documents: Array; media: Array; }> { @@ -258,18 +256,18 @@ export const OverlayRightPanelSettings = () => { const leaveGroupString = isPublic ? window.i18n('leaveCommunity') : lastMessage?.interactionType === ConversationInteractionType.Leave && - lastMessage?.interactionStatus === ConversationInteractionStatus.Error - ? window.i18n('deleteConversation') - : isKickedFromGroup - ? window.i18n('youGotKickedFromGroup') - : window.i18n('leaveGroup'); + lastMessage?.interactionStatus === ConversationInteractionStatus.Error + ? window.i18n('deleteConversation') + : isKickedFromGroup + ? window.i18n('youGotKickedFromGroup') + : window.i18n('leaveGroup'); const showUpdateGroupNameButton = isGroup && weAreAdmin && !commonNoShow; // legacy groups non-admin cannot change groupname anymore const showAddRemoveModeratorsButton = weAreAdmin && !commonNoShow && isPublic; const showUpdateGroupMembersButton = !isPublic && isGroup && !commonNoShow; - const deleteConvoAction = async () => { - await showLeaveGroupByConvoId(selectedConvoKey, selectedUsername); + const deleteConvoAction = () => { + void showLeaveGroupByConvoId(selectedConvoKey, selectedUsername); }; return ( @@ -338,7 +336,7 @@ export const OverlayRightPanelSettings = () => { void deleteConvoAction()} color={'var(--danger-color)'} iconType={'delete'} diff --git a/ts/components/leftpane/conversation-list-item/InteractionItem.tsx b/ts/components/leftpane/conversation-list-item/InteractionItem.tsx index 0e7b0031f..be887a046 100644 --- a/ts/components/leftpane/conversation-list-item/InteractionItem.tsx +++ b/ts/components/leftpane/conversation-list-item/InteractionItem.tsx @@ -7,7 +7,8 @@ import { ConversationInteractionStatus, ConversationInteractionType, } from '../../../interactions/conversationInteractions'; -import { getConversationController } from '../../../session/conversations'; + +import { ConvoHub } from '../../../session/conversations'; import { LastMessageType } from '../../../state/ducks/conversations'; import { assertUnreachable } from '../../../types/sqlSharedTypes'; import { MessageBody } from '../../conversation/message/message-content/MessageBody'; @@ -34,7 +35,7 @@ export const InteractionItem = (props: InteractionItemProps) => { // NOTE we want to reset the interaction state when the last message changes useEffect(() => { if (conversationId) { - const convo = getConversationController().get(conversationId); + const convo = ConvoHub.use().get(conversationId); if (storedLastMessageInteractionStatus !== convo.get('lastMessageInteractionStatus')) { setStoredLastMessageInteractionStatus(convo.get('lastMessageInteractionStatus')); @@ -64,15 +65,15 @@ export const InteractionItem = (props: InteractionItemProps) => { errorText = isCommunity ? window.i18n('leaveCommunityFailed') : isGroup - ? window.i18n('leaveGroupFailed') - : window.i18n('deleteConversationFailed'); + ? window.i18n('leaveGroupFailed') + : window.i18n('deleteConversationFailed'); text = interactionStatus === ConversationInteractionStatus.Error ? errorText : interactionStatus === ConversationInteractionStatus.Start || - interactionStatus === ConversationInteractionStatus.Loading - ? window.i18n('leaving') - : text; + interactionStatus === ConversationInteractionStatus.Loading + ? window.i18n('leaving') + : text; break; default: assertUnreachable( diff --git a/ts/components/menu/Menu.tsx b/ts/components/menu/Menu.tsx index d803f3cc3..43d885ced 100644 --- a/ts/components/menu/Menu.tsx +++ b/ts/components/menu/Menu.tsx @@ -126,6 +126,7 @@ export const DeletePrivateContactMenuItem = () => { await ConvoHub.use().delete1o1(convoId, { fromSyncMessage: false, justHidePrivate: false, + keepMessages: false, }); }, }) @@ -155,9 +156,9 @@ export const LeaveGroupOrCommunityMenuItem = () => { {isPublic ? window.i18n('leaveCommunity') : lastMessage?.interactionType === ConversationInteractionType.Leave && - lastMessage?.interactionStatus === ConversationInteractionStatus.Error - ? window.i18n('deleteConversation') - : window.i18n('leaveGroup')} + lastMessage?.interactionStatus === ConversationInteractionStatus.Error + ? window.i18n('deleteConversation') + : window.i18n('leaveGroup')} ); } @@ -542,8 +543,8 @@ export const NotificationForConvoMenuItem = (): JSX.Element | null => { n === 'all' || !n ? 'notificationForConvo_all' : n === 'disabled' - ? 'notificationForConvo_disabled' - : 'notificationForConvo_mentions_only'; + ? 'notificationForConvo_disabled' + : 'notificationForConvo_mentions_only'; return { value: n, name: window.i18n(keyToUse) }; }); diff --git a/ts/receiver/configMessage.ts b/ts/receiver/configMessage.ts index 0b3e03b4c..aa04970ab 100644 --- a/ts/receiver/configMessage.ts +++ b/ts/receiver/configMessage.ts @@ -341,6 +341,7 @@ async function deleteContactsFromDB(contactsToRemove: Array) { await ConvoHub.use().delete1o1(contactToRemove, { fromSyncMessage: true, justHidePrivate: false, + keepMessages: false, }); } catch (e) { window.log.warn( diff --git a/ts/state/ducks/metaGroups.ts b/ts/state/ducks/metaGroups.ts index 7c40dd2ee..3f430d4a4 100644 --- a/ts/state/ducks/metaGroups.ts +++ b/ts/state/ducks/metaGroups.ts @@ -49,7 +49,7 @@ import { } from '../../webworker/workers/browser/libsession_worker_interface'; import { StateType } from '../reducer'; import { openConversationWithMessages } from './conversations'; -import { resetOverlayMode } from './section'; +import { resetLeftOverlayMode } from './section'; type WithAddWithoutHistoryMembers = { withoutHistory: Array }; type WithAddWithHistoryMembers = { withHistory: Array }; @@ -195,7 +195,7 @@ const initNewGroupInWrapper = createAsyncThunk( convo.set({ active_at: Date.now() }); await convo.commit(); convo.updateLastMessage(); - dispatch(resetOverlayMode()); + dispatch(resetLeftOverlayMode()); // Everything is setup for this group, we now need to send the invites to each members, // privately and asynchronously, and gracefully handle errors with toasts.