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 { class MediaLibraryCard extends React.Component {
render() { 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'); const url = displayURL.get('url');
return ( return (
<Card <Card
@ -67,7 +77,7 @@ class MediaLibraryCard extends React.Component {
isPrivate={isPrivate} isPrivate={isPrivate}
> >
<CardImageWrapper> <CardImageWrapper>
{url ? <CardImage src={url} /> : <CardFileIcon>{type}</CardFileIcon>} {url && isViewableImage ? <CardImage src={url} /> : <CardFileIcon>{type}</CardFileIcon>}
</CardImageWrapper> </CardImageWrapper>
<CardText>{text}</CardText> <CardText>{text}</CardText>
</Card> </Card>

View File

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