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) { private async showLinkSharingConfirmationModalDialog(e: any) {
const pastedText = e.clipboardData.getData('text'); const pastedText = e.clipboardData.getData('text');
if (this.isURL(pastedText)) { if (this.isURL(pastedText) && !window.getSettingValue('link-preview-setting', false)) {
const alreadyDisplayedPopup = const alreadyDisplayedPopup =
(await getItemById(hasLinkPreviewPopupBeenDisplayed))?.value || false; (await getItemById(hasLinkPreviewPopupBeenDisplayed))?.value || false;
window.inboxStore?.dispatch( window.inboxStore?.dispatch(

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

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

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

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

Loading…
Cancel
Save