diff --git a/web/src/js/components/ContentView.jsx b/web/src/js/components/ContentView.jsx index 9ec0266b1..756625097 100644 --- a/web/src/js/components/ContentView.jsx +++ b/web/src/js/components/ContentView.jsx @@ -19,17 +19,17 @@ ContentView.propTypes = { ContentView.isContentTooLarge = msg => msg.contentLength > 1024 * 1024 * (ContentViews.ViewImage.matches(msg) ? 10 : 0.2) function ContentView(props) { - const { flow, message, contentView, selectView, displayLarge, setDisplayLarge, uploadContent, onContentChange, readonly } = props + const { flow, message, contentView, isDisplayLarge, displayLarge, uploadContent, onContentChange, readonly } = props - if (message.contentLength === 0) { + if (message.contentLength === 0 && readonly) { return } - if (message.contentLength === null) { + if (message.contentLength === null && readonly) { return } - if (!displayLarge && ContentView.isContentTooLarge(message)) { + if (!isDisplayLarge && ContentView.isContentTooLarge(message)) { return } @@ -39,7 +39,7 @@ function ContentView(props) {
- +     @@ -52,10 +52,9 @@ function ContentView(props) { export default connect( state => ({ contentView: state.ui.flow.contentView, - displayLarge: state.ui.flow.displayLarge, + isDisplayLarge: state.ui.flow.displayLarge, }), { - selectView: setContentView, displayLarge, updateEdit } diff --git a/web/src/js/components/ContentView/ContentLoader.jsx b/web/src/js/components/ContentView/ContentLoader.jsx index fb022df65..697085a9a 100644 --- a/web/src/js/components/ContentView/ContentLoader.jsx +++ b/web/src/js/components/ContentView/ContentLoader.jsx @@ -41,6 +41,10 @@ export default View => class extends React.Component { if (this.state.request) { this.state.request.abort() } + if(props.message.contentLength === 0 || props.message.contentLength === null){ + return this.setState({request: undefined, content: ""}) + } + let requestUrl = MessageUtils.getContentURL(props.flow, props.message) // We use XMLHttpRequest instead of fetch() because fetch() is not (yet) abortable. @@ -75,7 +79,7 @@ export default View => class extends React.Component { } render() { - return this.state.content ? ( + return this.state.content !== undefined ? ( ) : (
diff --git a/web/src/js/components/ContentView/ViewSelector.jsx b/web/src/js/components/ContentView/ViewSelector.jsx index 973d23332..89b362314 100644 --- a/web/src/js/components/ContentView/ViewSelector.jsx +++ b/web/src/js/components/ContentView/ViewSelector.jsx @@ -35,7 +35,7 @@ export default function ViewSelector({ message }) { return (
- auto: {autoViewName} + auto: {autoViewName} {Object.keys(ContentViews).map(name => name !== "ViewAuto" &&