Don't render links (or link previews) for blocked or unapproved conversations

This commit is contained in:
Evan Hahn 2021-02-02 11:09:53 -06:00 committed by GitHub
parent 267ae80442
commit 8f1bb6f087
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 105 additions and 33 deletions

View file

@ -2,6 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import * as React from 'react';
import { isBoolean } from 'lodash';
import { action } from '@storybook/addon-actions';
import { boolean, number, text } from '@storybook/addon-knobs';
@ -72,6 +73,12 @@ const createProps = (overrideProps: Partial<Props> = {}): Props => ({
i18n,
id: text('id', overrideProps.id || ''),
interactionMode: overrideProps.interactionMode || 'keyboard',
isBlocked: isBoolean(overrideProps.isBlocked)
? overrideProps.isBlocked
: false,
isMessageRequestAccepted: isBoolean(overrideProps.isMessageRequestAccepted)
? overrideProps.isMessageRequestAccepted
: true,
isTapToView: overrideProps.isTapToView,
isTapToViewError: overrideProps.isTapToViewError,
isTapToViewExpired: overrideProps.isTapToViewExpired,
@ -885,3 +892,31 @@ story.add('All the context menus', () => {
return <Message {...props} direction="outgoing" />;
});
story.add('Not approved, with link preview', () => {
const props = createProps({
previews: [
{
domain: 'signal.org',
image: {
contentType: IMAGE_PNG,
fileName: 'the-sax.png',
height: 240,
url: pngUrl,
width: 320,
},
isStickerPack: false,
title: 'Signal',
description:
'Say "hello" to a different messaging experience. An unexpected focus on privacy, combined with all of the features you expect.',
url: 'https://www.signal.org',
date: new Date(2020, 2, 10).valueOf(),
},
],
status: 'sent',
text: 'Be sure to look at https://www.signal.org',
isMessageRequestAccepted: false,
});
return renderBothDirections(props);
});