Blocked/unapproved convos: no clickable link preview images

This commit is contained in:
Evan Hahn 2022-11-30 19:24:38 -06:00 committed by GitHub
parent 30d1b29021
commit 38b921fad7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 12 deletions

View file

@ -784,7 +784,8 @@ $message-padding-horizontal: 12px;
&--nonclickable { &--nonclickable {
cursor: inherit; cursor: inherit;
.module-image__image { .module-image__image,
.module-image__border-overlay--with-click-handler {
cursor: inherit; cursor: inherit;
} }
} }

View file

@ -6,7 +6,7 @@ import React from 'react';
import { createPortal } from 'react-dom'; import { createPortal } from 'react-dom';
import classNames from 'classnames'; import classNames from 'classnames';
import getDirection from 'direction'; import getDirection from 'direction';
import { drop, groupBy, orderBy, take, unescape } from 'lodash'; import { drop, groupBy, noop, orderBy, take, unescape } from 'lodash';
import { Manager, Popper, Reference } from 'react-popper'; import { Manager, Popper, Reference } from 'react-popper';
import type { PreventOverflowModifier } from '@popperjs/core/lib/modifiers/preventOverflow'; import type { PreventOverflowModifier } from '@popperjs/core/lib/modifiers/preventOverflow';
@ -1118,16 +1118,18 @@ export class Message extends React.PureComponent<Props, State> {
'module-message__link-preview--nonclickable': !isClickable, 'module-message__link-preview--nonclickable': !isClickable,
} }
); );
const onPreviewImageClick = () => { const onPreviewImageClick = isClickable
if (first.image && !isDownloaded(first.image)) { ? () => {
kickOffAttachmentDownload({ if (first.image && !isDownloaded(first.image)) {
attachment: first.image, kickOffAttachmentDownload({
messageId: id, attachment: first.image,
}); messageId: id,
return; });
} return;
openLink(first.url); }
}; openLink(first.url);
}
: noop;
const contents = ( const contents = (
<> <>
{first.image && previewHasImage && isFullSizeImage ? ( {first.image && previewHasImage && isFullSizeImage ? (