* Mail: fix mail preview can not show attachments for smime encrypted messages

This commit is contained in:
hadi 2023-03-23 12:08:23 +01:00
parent 4ec4ddb2a1
commit bce12028c7

View File

@ -313,7 +313,7 @@ app.classes.mail = AppJS.extend(
this.et2.getArrayMgr("content").getEntry('mail_id'), this.et2.getArrayMgr("content").getEntry('mail_id'),
this.et2.getArrayMgr("content").getEntry('mail_displayattachments') this.et2.getArrayMgr("content").getEntry('mail_displayattachments')
); );
this.smimeAttachmentsCheckerInterval();
break; break;
case 'mail.compose': case 'mail.compose':
var composeToolbar = this.et2.getWidgetById('composeToolbar'); var composeToolbar = this.et2.getWidgetById('composeToolbar');
@ -1284,7 +1284,7 @@ app.classes.mail = AppJS.extend(
}); });
}, 300)); }, 300));
} }
if (data['smime']) this.smimeAttachmentsCheckerInterval();
var messages = {}; var messages = {};
messages['msg'] = [rowId]; messages['msg'] = [rowId];
@ -6033,30 +6033,19 @@ app.classes.mail = AppJS.extend(
this.set_smimeAttachmentsMobile(_attachments); this.set_smimeAttachmentsMobile(_attachments);
return; return;
} }
var attachmentArea = this.et2.getWidgetById(egw(window).is_popup()?'mail_displayattachments':'attachmentsBlock'); let data = {};
var content = this.et2.getArrayMgr('content'); let selected = [];
var mailPreview = this.et2.getWidgetById('mailPreviewContainer'); if (_attachments)
if (attachmentArea && _attachments && _attachments.length > 0)
{ {
attachmentArea.getParent().set_disabled(false); selected = [_attachments[0]['mail_id']];
content.data[attachmentArea.id] = _attachments; data = egw.dataGetUIDdata(selected[0]);
this.et2.setArrayMgr('contnet', content); // do not call mail_preview if we have the attachments already resolved, avoid infinit loop
attachmentArea.getDOMNode().classList.remove('loading'); if (data.data.attachmentsBlock.length>0) return;
attachmentArea.set_value({content:_attachments});
if (attachmentArea.id == 'attachmentsBlock') data.data.attachmentsBlock = _attachments;
{ data.data.attachmentsBlockTitle = _attachments.lenght;
var a_node = attachmentArea.getDOMNode(); egw.dataStoreUID(data.uid, data);
var m_node = mailPreview.getDOMNode(); this.mail_preview(selected, this.et2.getWidgetById('nm'));
var offset = m_node.offsetTop - a_node.offsetTop;
if (a_node.offsetTop + a_node.offsetHeight > m_node.offsetTop)
{
m_node.style.setProperty('top', m_node.offsetTop + offset+"px");
}
}
}
else
{
attachmentArea.getParent().set_disabled(true);
} }
}, },
/** /**