diff --git a/frontend/src/components/TopicCard/Attachments.js b/frontend/src/components/TopicCard/Attachments.js index 2d94a8c7..2f29b53a 100644 --- a/frontend/src/components/TopicCard/Attachments.js +++ b/frontend/src/components/TopicCard/Attachments.js @@ -61,7 +61,7 @@ class Attachments extends Component { loadLink = () => { this.setState({embedlyLinkStarted: true}) var e = embedly('card', document.getElementById('embedlyLink')) - if (e.type === 'error') this.setState({embedlyLinkError: true}) + if (e && e.type === 'error') this.setState({embedlyLinkError: true}) } removeLink = () => { @@ -76,39 +76,48 @@ class Attachments extends Component { render = () => { const { topic, ActiveMapper } = this.props const { linkEdit, embedlyLinkLoaded, embedlyLinkStarted, embedlyLinkError } = this.state - var authorizedToEdit = topic.authorizeToEdit(ActiveMapper) + const authorizedToEdit = topic.authorizeToEdit(ActiveMapper) const hasAttachment = topic.get('link') && topic.get('link') !== '' - if (hasAttachment) { - return ( -