Handle attachment load failure for quoted message
This commit is contained in:
parent
f1ff040842
commit
000dc3a159
1 changed files with 32 additions and 17 deletions
|
@ -1069,7 +1069,7 @@
|
||||||
return messages.reduce((acc, message) => {
|
return messages.reduce((acc, message) => {
|
||||||
const { source, sent_at: sentAt } = message.attributes;
|
const { source, sent_at: sentAt } = message.attributes;
|
||||||
|
|
||||||
// Checking for notification messages without a sender
|
// Checking for notification messages (safety number change, timer change)
|
||||||
if (!source && message.isIncoming()) {
|
if (!source && message.isIncoming()) {
|
||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
@ -1112,19 +1112,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const queryFirst = queryAttachments[0];
|
const queryFirst = queryAttachments[0];
|
||||||
queryMessage.attachments[0] = await loadAttachmentData(queryFirst);
|
try {
|
||||||
|
queryMessage.attachments[0] = await loadAttachmentData(queryFirst);
|
||||||
|
|
||||||
// Note: it would be nice to take the full-size image and downsample it into
|
// Note: it would be nice to take the full-size image and downsample it into
|
||||||
// a true thumbnail here.
|
// a true thumbnail here.
|
||||||
queryMessage.updateImageUrl();
|
queryMessage.updateImageUrl();
|
||||||
|
|
||||||
// We need to differentiate between messages we load from database and those already
|
// We need to differentiate between messages we load from database and those
|
||||||
// in memory. More cleanup needs to happen on messages from the database because
|
// already in memory. More cleanup needs to happen on messages from the database
|
||||||
// they aren't tracked any other way.
|
// because they aren't tracked any other way.
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
message.quotedMessageFromDatabase = queryMessage;
|
message.quotedMessageFromDatabase = queryMessage;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(
|
||||||
|
'Problem loading attachment data for quoted message from database',
|
||||||
|
error && error.stack ? error.stack : error
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async loadQuotedMessage(message, quotedMessage) {
|
async loadQuotedMessage(message, quotedMessage) {
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
|
@ -1145,13 +1153,20 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const queryFirst = quotedAttachments[0];
|
try {
|
||||||
// eslint-disable-next-line no-param-reassign
|
const queryFirst = quotedAttachments[0];
|
||||||
quotedMessage.attributes.attachments[0] = await loadAttachmentData(queryFirst);
|
// eslint-disable-next-line no-param-reassign
|
||||||
|
quotedMessage.attributes.attachments[0] = await loadAttachmentData(queryFirst);
|
||||||
|
|
||||||
// Note: it would be nice to take the full-size image and downsample it into
|
// Note: it would be nice to take the full-size image and downsample it into
|
||||||
// a true thumbnail here.
|
// a true thumbnail here.
|
||||||
quotedMessage.updateImageUrl();
|
quotedMessage.updateImageUrl();
|
||||||
|
} catch (error) {
|
||||||
|
console.log(
|
||||||
|
'Problem loading attachment data for quoted message',
|
||||||
|
error && error.stack ? error.stack : error
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async loadQuoteThumbnail(message) {
|
async loadQuoteThumbnail(message) {
|
||||||
const { quote } = message.attributes;
|
const { quote } = message.attributes;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue