fix(media-library): no render of non-viewable files (#2546)

This commit is contained in:
Bartholomew 2019-08-28 23:27:48 +01:00 committed by Shawn Erquhart
parent be7f443d6d
commit 4c5fe6a606
2 changed files with 13 additions and 2 deletions

View File

@ -55,7 +55,17 @@ const CardText = styled.p`
class MediaLibraryCard extends React.Component {
render() {
const { isSelected, displayURL, text, onClick, width, margin, isPrivate, type } = this.props;
const {
isSelected,
displayURL,
text,
onClick,
width,
margin,
isPrivate,
type,
isViewableImage,
} = this.props;
const url = displayURL.get('url');
return (
<Card
@ -67,7 +77,7 @@ class MediaLibraryCard extends React.Component {
isPrivate={isPrivate}
>
<CardImageWrapper>
{url ? <CardImage src={url} /> : <CardFileIcon>{type}</CardFileIcon>}
{url && isViewableImage ? <CardImage src={url} /> : <CardFileIcon>{type}</CardFileIcon>}
</CardImageWrapper>
<CardText>{text}</CardText>
</Card>

View File

@ -52,6 +52,7 @@ const MediaLibraryCardGrid = ({
displayURL={displayURLs.get(file.id, file.url ? Map({ url: file.url }) : Map())}
loadDisplayURL={() => loadDisplayURL(file)}
type={file.type}
isViewableImage={file.isViewableImage}
/>
))}
{!canLoadMore ? null : <Waypoint onEnter={onLoadMore} />}