diff --git a/ts/interactions/conversationInteractions.ts b/ts/interactions/conversationInteractions.ts index e7e4ea6be..1d16757b0 100644 --- a/ts/interactions/conversationInteractions.ts +++ b/ts/interactions/conversationInteractions.ts @@ -510,30 +510,9 @@ export async function showLeaveGroupByConvoId(conversationId: string, name: stri conversationId, }) ); - // TODO this is post release chunk3 stuff: Only to be used after the closed group rebuild chunk3 - // const onClickOkLastAdmin = () => { - // /* TODO */ - // }; - // const onClickCloseLastAdmin = () => { - // /* TODO */ - // }; - // window?.inboxStore?.dispatch( - // updateConfirmModal({ - // title: window.i18n('groupLeave'), - // message: window.i18n('leaveGroupConfirmationOnlyAdmin', {name: name ?? ''}), - // messageSub: window.i18n('leaveGroupConfirmationOnlyAdminWarning'), - // onClickOk: onClickOkLastAdmin, - // okText: window.i18n('addModerator'), - // cancelText: window.i18n('leave'), - // onClickCancel: onClickCloseLastAdmin, - // closeTheme: SessionButtonColor.Danger, - // onClickClose, - // showExitIcon: true, - // headerReverse: true, - // conversationId, - // }) - // ); - } else if (isPublic || (isClosedGroup && !isAdmin)) { + return; + } + if (isPublic || (isClosedGroup && !isAdmin)) { window?.inboxStore?.dispatch( updateConfirmModal({ title: isPublic ? window.i18n('communityLeave') : window.i18n('groupLeave'), diff --git a/ts/node/sql.ts b/ts/node/sql.ts index f70f1f986..554b23e36 100644 --- a/ts/node/sql.ts +++ b/ts/node/sql.ts @@ -1108,7 +1108,7 @@ async function getAllMessagesWithAttachmentsInConversationSentBefore( .all({ conversationId, beforeMs: deleteAttachBeforeSeconds * 1000 }); const messages = map(rows, row => jsonToObject(row.json)); const messagesWithAttachments = messages.filter(m => { - return getExternalFilesForMessage(m).some(a => !isEmpty(a) && isString(a)); // when we remove an attachment, we set the path to '' so it should be excluded here + return getExternalFilesForMessage(m, false).some(a => !isEmpty(a) && isString(a)); // when we remove an attachment, we set the path to '' so it should be excluded here }); return messagesWithAttachments; } @@ -2079,7 +2079,7 @@ function getMessagesWithFileAttachments(conversationId: string, limit: number) { return map(rows, row => jsonToObject(row.json)); } -function getExternalFilesForMessage(message: any) { +function getExternalFilesForMessage(message: any, includePreview = true) { const { attachments, quote, preview } = message; const files: Array = []; @@ -2108,7 +2108,7 @@ function getExternalFilesForMessage(message: any) { }); } - if (preview && preview.length) { + if (includePreview && preview && preview.length) { forEach(preview, item => { const { image } = item; diff --git a/ts/session/apis/snode_api/factories/StoreGroupRequestFactory.ts b/ts/session/apis/snode_api/factories/StoreGroupRequestFactory.ts index 592cbb336..1e61264f5 100644 --- a/ts/session/apis/snode_api/factories/StoreGroupRequestFactory.ts +++ b/ts/session/apis/snode_api/factories/StoreGroupRequestFactory.ts @@ -103,11 +103,11 @@ function makeStoreGroupKeysSubRequest({ if (!group.secretKey || isEmpty(group.secretKey)) { window.log.debug( - `pushChangesToGroupSwarmIfNeeded: ${ed25519Str(groupPk)}: keysEncryptedmessage not empty but we do not have the secretKey` + `makeStoreGroupKeysSubRequest: ${ed25519Str(groupPk)}: keysEncryptedmessage not empty but we do not have the secretKey` ); throw new Error( - 'pushChangesToGroupSwarmIfNeeded: keysEncryptedmessage not empty but we do not have the secretKey' + 'makeStoreGroupKeysSubRequest: keysEncryptedmessage not empty but we do not have the secretKey' ); } return new StoreGroupKeysSubRequest({ @@ -136,11 +136,11 @@ function makeStoreGroupConfigSubRequest({ if (!group.secretKey || isEmpty(group.secretKey)) { window.log.debug( - `pushChangesToGroupSwarmIfNeeded: ${ed25519Str(groupPk)}: pendingConfigMsgs not empty but we do not have the secretKey` + `makeStoreGroupConfigSubRequest: ${ed25519Str(groupPk)}: pendingConfigMsgs not empty but we do not have the secretKey` ); throw new Error( - 'pushChangesToGroupSwarmIfNeeded: pendingConfigMsgs not empty but we do not have the secretKey' + 'makeStoreGroupConfigSubRequest: pendingConfigMsgs not empty but we do not have the secretKey' ); } diff --git a/ts/session/conversations/ConversationController.ts b/ts/session/conversations/ConversationController.ts index efb126115..5be7a8397 100644 --- a/ts/session/conversations/ConversationController.ts +++ b/ts/session/conversations/ConversationController.ts @@ -317,7 +317,7 @@ class ConvoController { } catch (e) { // nothing to do } - if (groupInUserGroup && nameInMetaGroup && groupInUserGroup.name !== nameInMetaGroup) { + if (groupInUserGroup && nameInMetaGroup) { groupInUserGroup.name = nameInMetaGroup; } await UserGroupsWrapperActions.setGroup(groupInUserGroup);