This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
src/components/views/messages Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ export default class MImageBody extends React.Component {
8585 showImage ( ) {
8686 localStorage . setItem ( "mx_ShowImage_" + this . props . mxEvent . getId ( ) , "true" ) ;
8787 this . setState ( { showImage : true } ) ;
88+ this . _downloadImage ( ) ;
8889 }
8990
9091 onClick ( ev ) {
@@ -253,10 +254,7 @@ export default class MImageBody extends React.Component {
253254 }
254255 }
255256
256- componentDidMount ( ) {
257- this . unmounted = false ;
258- this . context . on ( 'sync' , this . onClientSync ) ;
259-
257+ _downloadImage ( ) {
260258 const content = this . props . mxEvent . getContent ( ) ;
261259 if ( content . file !== undefined && this . state . decryptedUrl === null ) {
262260 let thumbnailPromise = Promise . resolve ( null ) ;
@@ -289,9 +287,18 @@ export default class MImageBody extends React.Component {
289287 } ) ;
290288 } ) ;
291289 }
290+ }
291+
292+ componentDidMount ( ) {
293+ this . unmounted = false ;
294+ this . context . on ( 'sync' , this . onClientSync ) ;
295+
296+ const showImage = this . state . showImage ||
297+ localStorage . getItem ( "mx_ShowImage_" + this . props . mxEvent . getId ( ) ) === "true" ;
292298
293- // Remember that the user wanted to show this particular image
294- if ( ! this . state . showImage && localStorage . getItem ( "mx_ShowImage_" + this . props . mxEvent . getId ( ) ) === "true" ) {
299+ if ( showImage ) {
300+ // Don't download anything becaue we don't want to display anything.
301+ this . _downloadImage ( ) ;
295302 this . setState ( { showImage : true } ) ;
296303 }
297304
You can’t perform that action at this time.
0 commit comments