Disable forward for messages with embedded contact
This commit is contained in:
@@ -188,6 +188,7 @@ function initializeMigrations({
|
||||
const attachmentsPath = getPath(userDataPath);
|
||||
const readAttachmentData = createReader(attachmentsPath);
|
||||
const loadAttachmentData = Type.loadData(readAttachmentData);
|
||||
const loadContactData = MessageType.loadContactData(loadAttachmentData);
|
||||
const loadPreviewData = MessageType.loadPreviewData(loadAttachmentData);
|
||||
const loadQuoteData = MessageType.loadQuoteData(loadAttachmentData);
|
||||
const loadStickerData = MessageType.loadStickerData(loadAttachmentData);
|
||||
@@ -248,6 +249,7 @@ function initializeMigrations({
|
||||
getAbsoluteStickerPath,
|
||||
getAbsoluteTempPath,
|
||||
loadAttachmentData,
|
||||
loadContactData,
|
||||
loadMessage: MessageType.createAttachmentLoader(loadAttachmentData),
|
||||
loadPreviewData,
|
||||
loadQuoteData,
|
||||
|
@@ -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');
|
||||
|
Reference in New Issue
Block a user