Merge pull request #1789 from Bilb/fix-lnik-preview-embeded-url

Fix link preview embeded url
pull/1792/head
Audric Ackermann 4 years ago committed by GitHub
commit 5f994851d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -239,7 +239,7 @@ class SessionCompositionBoxInner extends React.Component<Props, State> {
*/
private async showLinkSharingConfirmationModalDialog(e: any) {
const pastedText = e.clipboardData.getData('text');
if (this.isURL(pastedText)) {
if (this.isURL(pastedText) && !window.getSettingValue('link-preview-setting', false)) {
const alreadyDisplayedPopup =
(await getItemById(hasLinkPreviewPopupBeenDisplayed))?.value || false;
window.inboxStore?.dispatch(

@ -38,7 +38,6 @@ export interface Preview {
export interface PreviewWithAttachmentUrl {
url: string;
id: number;
title?: string;
image?: AttachmentPointerWithUrl;
}

@ -22,7 +22,7 @@ interface UploadParams {
}
export interface RawPreview {
url?: string;
url: string;
title?: string;
image: Attachment;
}
@ -129,8 +129,6 @@ export class AttachmentFsV2Utils {
return {
...preview,
image,
url: image.url,
id: image.id,
};
});
return _.compact(await Promise.all(promises));

@ -8,6 +8,7 @@ import {
PreviewWithAttachmentUrl,
Quote,
QuotedAttachment,
QuotedAttachmentWithUrl,
} from '../messages/outgoing/visibleMessage/VisibleMessage';
import { uploadFileOpenGroupV2 } from '../../opengroup/opengroupV2/OpenGroupAPIV2';
import { addAttachmentPadding } from '../crypto/BufferPadding';
@ -105,7 +106,7 @@ export async function uploadQuoteThumbnailsV2(
}
const promises = (quote.attachments ?? []).map(async attachment => {
let thumbnail: PreviewWithAttachmentUrl | undefined;
let thumbnail: QuotedAttachment | undefined;
if (attachment.thumbnail) {
thumbnail = await exports.uploadV2({
attachment: attachment.thumbnail,

@ -88,7 +88,7 @@ describe('VisibleMessage', () => {
it('can create message with a preview', () => {
let preview: PreviewWithAttachmentUrl;
preview = { url: 'url', title: 'title', id: 1234 };
preview = { url: 'url', title: 'title' };
const previews = new Array<PreviewWithAttachmentUrl>();
previews.push(preview);

Loading…
Cancel
Save