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 {
cursor: inherit;
.module-image__image {
.module-image__image,
.module-image__border-overlay--with-click-handler {
cursor: inherit;
}
}

View file

@ -6,7 +6,7 @@ import React from 'react';
import { createPortal } from 'react-dom';
import classNames from 'classnames';
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 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,
}
);
const onPreviewImageClick = () => {
if (first.image && !isDownloaded(first.image)) {
kickOffAttachmentDownload({
attachment: first.image,
messageId: id,
});
return;
}
openLink(first.url);
};
const onPreviewImageClick = isClickable
? () => {
if (first.image && !isDownloaded(first.image)) {
kickOffAttachmentDownload({
attachment: first.image,
messageId: id,
});
return;
}
openLink(first.url);
}
: noop;
const contents = (
<>
{first.image && previewHasImage && isFullSizeImage ? (