diff --git a/js/models/conversations.js b/js/models/conversations.js index 15fb7fa8b2..aea404a6fa 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -1159,8 +1159,8 @@ const { attachments, id, author } = quote; const first = attachments[0]; - if (!first || first.thumbnail) { - return true; + if (!first || message.quoteThumbnail) { + return false; } if (!Signal.Util.GoogleChrome.isImageTypeSupported(first.contentType) && @@ -1202,7 +1202,7 @@ const { attachments } = quote; const first = attachments[0]; - if (!first || first.thumbnail) { + if (!first || message.quoteThumbnail) { return; } @@ -1232,7 +1232,8 @@ const { quote } = message.attributes; const { attachments } = quote; const first = attachments[0]; - if (!first) { + + if (!first || message.quoteThumbnail) { return false; } @@ -1292,6 +1293,12 @@ return; } + // No need to go further if we already have a thumbnail + if (gotThumbnail) { + this.forceRender(message); + return; + } + // We only go further if we need more data for this message. It's always important // to grab the quoted message to allow for navigating to it by clicking. const { attachments } = quote; @@ -1300,7 +1307,7 @@ } // We've don't want to go to the database or load thumbnails a second time. - if (message.quoteIsProcessed || gotThumbnail) { + if (message.quoteIsProcessed) { return; } // eslint-disable-next-line no-param-reassign diff --git a/js/views/file_input_view.js b/js/views/file_input_view.js index 151f99b347..190d168cfa 100644 --- a/js/views/file_input_view.js +++ b/js/views/file_input_view.js @@ -117,7 +117,9 @@ const arrayBuffer = await blobToArrayBuffer(blob); const screenshotObjectUrl = makeObjectUrl(arrayBuffer, 'image/png'); - return makeImageThumbnail(size, screenshotObjectUrl); + const thumbnail = await makeImageThumbnail(size, screenshotObjectUrl); + URL.revokeObjectURL(screenshotObjectUrl); + return thumbnail; } Whisper.FileInputView = Backbone.View.extend({