Set right set of attachments object for smime resolved attachments sent to client-side

This commit is contained in:
hadi 2023-04-21 11:57:21 +02:00
parent e6dfaf0f5c
commit 4080a60aa2

View File

@ -6049,16 +6049,26 @@ app.classes.mail = AppJS.extend(
} }
let data = {}; let data = {};
let selected = []; let selected = [];
let cmprAttchObjs = function(_obj1,_obj2)
{
for (let i=0;i<_obj1.length;i++)
{
if (_obj1[i]['mail_id'] != _obj2[i]['mail_id'] || _obj1[i]['partID'] != _obj2[i]['partID']) return false;
}
return true;
};
if (_attachments) if (_attachments)
{ {
selected = [_attachments[0]['mail_id']]; selected = [_attachments[0]['mail_id']];
data = egw.dataGetUIDdata(selected[0]); data = egw.dataGetUIDdata(selected[0]);
// do not call mail_preview if we have the attachments already resolved, avoid infinit loop // do not call mail_preview if we have the attachments already resolved, avoid infinit loop
if (data.data.attachmentsBlock.length>0) return; if (data.data.attachmentsBlock.length>0 && cmprAttchObjs(data.data.attachmentsBlock, _attachments)) return;
data.data.attachmentsBlock = _attachments; data.data.attachmentsBlock = _attachments;
data.data.attachmentsBlockTitle = _attachments.lenght; data.data.attachmentsBlockTitle = _attachments.lenght;
egw.dataStoreUID(data.uid, data); egw.dataStoreUID(data.data.uid, data.data);
this.mail_preview(selected, this.et2.getWidgetById('nm')); this.mail_preview(selected, this.et2.getWidgetById('nm'));
} }
}, },