"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/backup_test.js" between
Signal-Desktop-1.35.2.tar.gz and Signal-Desktop-1.36.1.tar.gz

About: Signal-Desktop is a cross-platform encrypted messaging service (also available for mobile devices).

backup_test.js  (Signal-Desktop-1.35.2):backup_test.js  (Signal-Desktop-1.36.1)
skipping to change at line 366 skipping to change at line 366
return async (message, context) => { return async (message, context) => {
if (!message.quote) { if (!message.quote) {
return message; return message;
} }
const wrappedMapper = async attachment => { const wrappedMapper = async attachment => {
if (!attachment || !attachment.thumbnail) { if (!attachment || !attachment.thumbnail) {
return attachment; return attachment;
} }
return Object.assign({}, attachment, { return {
...attachment,
thumbnail: await mapper(attachment.thumbnail, context), thumbnail: await mapper(attachment.thumbnail, context),
}); };
}; };
const quotedAttachments = const quotedAttachments =
(message.quote && message.quote.attachments) || []; (message.quote && message.quote.attachments) || [];
return Object.assign({}, message, { return {
quote: Object.assign({}, message.quote, { ...message,
quote: {
...message.quote,
attachments: await Promise.all( attachments: await Promise.all(
quotedAttachments.map(wrappedMapper) quotedAttachments.map(wrappedMapper)
), ),
}), },
}); };
}; };
} }
async function loadAllFilesFromDisk(message) { async function loadAllFilesFromDisk(message) {
const loadThumbnails = _mapQuotedAttachments(thumbnail => { const loadThumbnails = _mapQuotedAttachments(thumbnail => {
// we want to be bulletproof to thumbnails without data // we want to be bulletproof to thumbnails without data
if (!thumbnail.path) { if (!thumbnail.path) {
return thumbnail; return thumbnail;
} }
return wrappedLoadAttachment(thumbnail); return wrappedLoadAttachment(thumbnail);
}); });
return Object.assign({}, await loadThumbnails(message), { return {
...(await loadThumbnails(message)),
contact: await Promise.all( contact: await Promise.all(
(message.contact || []).map(async contact => { (message.contact || []).map(async contact => {
return contact && contact.avatar && contact.avatar.avatar return contact && contact.avatar && contact.avatar.avatar
? Object.assign({}, contact, { ? {
avatar: Object.assign({}, contact.avatar, { ...contact,
avatar: {
...contact.avatar,
avatar: await wrappedLoadAttachment( avatar: await wrappedLoadAttachment(
contact.avatar.avatar contact.avatar.avatar
), ),
}), },
}) }
: contact; : contact;
}) })
), ),
attachments: await Promise.all( attachments: await Promise.all(
(message.attachments || []).map(async attachment => { (message.attachments || []).map(async attachment => {
await wrappedLoadAttachment(attachment); await wrappedLoadAttachment(attachment);
if (attachment.thumbnail) { if (attachment.thumbnail) {
await wrappedLoadAttachment(attachment.thumbnail); await wrappedLoadAttachment(attachment.thumbnail);
} }
skipping to change at line 432 skipping to change at line 438
), ),
preview: await Promise.all( preview: await Promise.all(
(message.preview || []).map(async item => { (message.preview || []).map(async item => {
if (item.image) { if (item.image) {
await wrappedLoadAttachment(item.image); await wrappedLoadAttachment(item.image);
} }
return item; return item;
}) })
), ),
}); };
} }
let backupDir; let backupDir;
try { try {
// Seven total: // Seven total:
// - Five from image/video attachments // - Five from image/video attachments
// - One from embedded contact avatar // - One from embedded contact avatar
// - One from embedded quoted attachment thumbnail // - One from embedded quoted attachment thumbnail
// - One from a link preview image // - One from a link preview image
const ATTACHMENT_COUNT = 8; const ATTACHMENT_COUNT = 8;
 End of changes. 8 change blocks. 
12 lines changed or deleted 18 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)