Fixes link preview send in stories

This commit is contained in:
Josh Perez 2023-01-27 10:39:38 -05:00 committed by GitHub
parent 2637df0c42
commit e334490cf4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,20 +29,6 @@ import { collect } from './iterables';
import { DurationInSeconds } from './durations';
import { sanitizeLinkPreview } from '../services/LinkPreview';
function cleanLinkPreviewIfAny(attachment: AttachmentType): AttachmentType {
if (!attachment.textAttachment || !attachment.textAttachment.preview) {
return attachment;
}
return {
...attachment,
textAttachment: {
...attachment.textAttachment,
preview: undefined,
},
};
}
export async function sendStoryMessage(
listIds: Array<string>,
conversationIds: Array<string>,
@ -153,8 +139,7 @@ export async function sendStoryMessage(
sendStateByListId.set(distributionList.id, sendStateByConversationId);
});
const cleanedAttachment = cleanLinkPreviewIfAny(attachment);
const attachments: Array<AttachmentType> = [cleanedAttachment];
const attachments: Array<AttachmentType> = [attachment];
const linkPreview = attachment?.textAttachment?.preview;
const sanitizedLinkPreview = linkPreview