Move to central MIME functions, remove some console.log
And generally address PR feedback.
This commit is contained in:
parent
f255cbcbe3
commit
fce9bb7342
6 changed files with 21 additions and 17 deletions
|
@ -1137,13 +1137,11 @@
|
|||
|
||||
// Maybe in the future we could try to pull thumbnails video ourselves,
|
||||
// but for now we will rely on incoming thumbnails only.
|
||||
console.log({ first, contentType: first ? first.contentType : null });
|
||||
if (!first || !MIME.isImage(first.contentType)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const quotedAttachments = quotedMessage.get('attachments') || [];
|
||||
console.log({ quotedMessage, quotedAttachments });
|
||||
if (quotedAttachments.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -1155,7 +1153,6 @@
|
|||
// Note: it would be nice to take the full-size image and downsample it into
|
||||
// a true thumbnail here.
|
||||
quotedMessage.updateImageUrl();
|
||||
console.log({ quotedMessage });
|
||||
},
|
||||
async loadQuoteThumbnail(message) {
|
||||
const { quote } = message.attributes;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
'use strict';
|
||||
|
||||
const ESCAPE_KEY_CODE = 27;
|
||||
const { Signal } = window;
|
||||
|
||||
const FileView = Whisper.View.extend({
|
||||
tagName: 'div',
|
||||
|
@ -133,15 +134,16 @@
|
|||
return false;
|
||||
},
|
||||
isAudio() {
|
||||
return this.model.contentType.startsWith('audio/');
|
||||
const { contentType } = this.model;
|
||||
return Signal.Types.MIME.isAudio(contentType);
|
||||
},
|
||||
isVideo() {
|
||||
const type = this.model.contentType;
|
||||
return type.startsWith('video/') && type !== 'image/wmv';
|
||||
const { contentType } = this.model;
|
||||
return Signal.Types.MIME.isVideo(contentType);
|
||||
},
|
||||
isImage() {
|
||||
const type = this.model.contentType;
|
||||
return type.startsWith('image/') && type !== 'image/tiff';
|
||||
const { contentType } = this.model;
|
||||
return Signal.Types.MIME.isImage(contentType);
|
||||
},
|
||||
mediaType() {
|
||||
if (this.isVoiceMessage()) {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
const { HTML } = window.Signal;
|
||||
const { Signal } = window;
|
||||
const { loadAttachmentData } = window.Signal.Migrations;
|
||||
|
||||
window.Whisper = window.Whisper || {};
|
||||
|
@ -401,7 +401,7 @@
|
|||
|
||||
return Object.assign({}, attachment, {
|
||||
// eslint-disable-next-line no-bitwise
|
||||
isVoiceMessage: attachment.flags & VOICE_FLAG,
|
||||
isVoiceMessage: Boolean(attachment.flags & VOICE_FLAG),
|
||||
thumbnail,
|
||||
});
|
||||
}
|
||||
|
@ -456,7 +456,7 @@
|
|||
}
|
||||
|
||||
const first = attachments[0];
|
||||
if (first.contentType.startsWith('image/') && first.contentType !== 'image/tiff') {
|
||||
if (Signal.Types.MIME.isImage(first.contentType)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -483,7 +483,7 @@
|
|||
|
||||
if (body.length > 0) {
|
||||
const escapedBody = body.html();
|
||||
body.html(HTML.render(escapedBody));
|
||||
body.html(Signal.HTML.render(escapedBody));
|
||||
}
|
||||
|
||||
this.renderSent();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue