Disable forward for messages with embedded contact

This commit is contained in:
Scott Nonnenberg
2022-04-11 13:57:44 -07:00
committed by GitHub
parent 6d816d01ad
commit 7f89f6162f
14 changed files with 442 additions and 185 deletions

View File

@@ -562,6 +562,42 @@ exports.loadQuoteData = loadAttachmentData => {
};
};
exports.loadContactData = loadAttachmentData => {
if (!isFunction(loadAttachmentData)) {
throw new TypeError('loadContactData: loadAttachmentData is required');
}
return async contact => {
if (!contact) {
return null;
}
return Promise.all(
contact.map(async item => {
if (
!item ||
!item.avatar ||
!item.avatar.avatar ||
!item.avatar.avatar.path
) {
return item;
}
return {
...item,
avatar: {
...item.avatar,
avatar: {
...item.avatar.avatar,
...(await loadAttachmentData(item.avatar.avatar)),
},
},
};
})
);
};
};
exports.loadPreviewData = loadAttachmentData => {
if (!isFunction(loadAttachmentData)) {
throw new TypeError('loadPreviewData: loadAttachmentData is required');