fix: do not remove link previews as part of the "clear all attachments"

pull/3281/head
Audric Ackermann 5 months ago
parent bd22cc6b49
commit 1957b3ece3
No known key found for this signature in database

@ -510,30 +510,9 @@ export async function showLeaveGroupByConvoId(conversationId: string, name: stri
conversationId, conversationId,
}) })
); );
// TODO this is post release chunk3 stuff: Only to be used after the closed group rebuild chunk3 return;
// const onClickOkLastAdmin = () => { }
// /* TODO */ if (isPublic || (isClosedGroup && !isAdmin)) {
// };
// 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)) {
window?.inboxStore?.dispatch( window?.inboxStore?.dispatch(
updateConfirmModal({ updateConfirmModal({
title: isPublic ? window.i18n('communityLeave') : window.i18n('groupLeave'), title: isPublic ? window.i18n('communityLeave') : window.i18n('groupLeave'),

@ -1108,7 +1108,7 @@ async function getAllMessagesWithAttachmentsInConversationSentBefore(
.all({ conversationId, beforeMs: deleteAttachBeforeSeconds * 1000 }); .all({ conversationId, beforeMs: deleteAttachBeforeSeconds * 1000 });
const messages = map(rows, row => jsonToObject(row.json)); const messages = map(rows, row => jsonToObject(row.json));
const messagesWithAttachments = messages.filter(m => { 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; return messagesWithAttachments;
} }
@ -2079,7 +2079,7 @@ function getMessagesWithFileAttachments(conversationId: string, limit: number) {
return map(rows, row => jsonToObject(row.json)); return map(rows, row => jsonToObject(row.json));
} }
function getExternalFilesForMessage(message: any) { function getExternalFilesForMessage(message: any, includePreview = true) {
const { attachments, quote, preview } = message; const { attachments, quote, preview } = message;
const files: Array<string> = []; const files: Array<string> = [];
@ -2108,7 +2108,7 @@ function getExternalFilesForMessage(message: any) {
}); });
} }
if (preview && preview.length) { if (includePreview && preview && preview.length) {
forEach(preview, item => { forEach(preview, item => {
const { image } = item; const { image } = item;

@ -103,11 +103,11 @@ function makeStoreGroupKeysSubRequest({
if (!group.secretKey || isEmpty(group.secretKey)) { if (!group.secretKey || isEmpty(group.secretKey)) {
window.log.debug( 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( 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({ return new StoreGroupKeysSubRequest({
@ -136,11 +136,11 @@ function makeStoreGroupConfigSubRequest({
if (!group.secretKey || isEmpty(group.secretKey)) { if (!group.secretKey || isEmpty(group.secretKey)) {
window.log.debug( 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( 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'
); );
} }

@ -317,7 +317,7 @@ class ConvoController {
} catch (e) { } catch (e) {
// nothing to do // nothing to do
} }
if (groupInUserGroup && nameInMetaGroup && groupInUserGroup.name !== nameInMetaGroup) { if (groupInUserGroup && nameInMetaGroup) {
groupInUserGroup.name = nameInMetaGroup; groupInUserGroup.name = nameInMetaGroup;
} }
await UserGroupsWrapperActions.setGroup(groupInUserGroup); await UserGroupsWrapperActions.setGroup(groupInUserGroup);

Loading…
Cancel
Save