From 6124a7fc21acf934a8ba5631970669b84f52e0a9 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 30 Nov 2015 14:55:39 +0000 Subject: [PATCH] W.I.P. of new approach for mail winmail.dat attachment handling - Try to use mail client cache and store resolved winmail.dat attachments, it will avoid resolve it again --- mail/js/app.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mail/js/app.js b/mail/js/app.js index 8631f4c78d..aca0b7d77c 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -847,21 +847,28 @@ app.classes.mail = AppJS.extend( // Try to resolve winmail.data attachment if (dataElem.data && dataElem.data.attachmentsBlock[0] - && dataElem.data.attachmentsBlock[0].winmailFlag) + && dataElem.data.attachmentsBlock[0].winmailFlag + && (dataElem.data.attachmentsBlock[0].mimetype =='application/ms-tnef' || + dataElem.data.attachmentsBlock[0].filename == "winmail.dat")) { attachmentArea.getDOMNode().classList.add('loading'); - this.egw.jsonq('mail.mail_ui.ajax_resolveWinmail',[_id], function(_data){ + this.egw.jsonq('mail.mail_ui.ajax_resolveWinmail',[_id], jQuery.proxy(function(_data){ attachmentArea.getDOMNode().classList.remove('loading'); if (typeof _data == 'object') { attachmentArea.set_value({content:_data}); + + this.data.attachmentsBlock = _data; + // Update client cache to avoid resolving winmail.dat attachment again + egw.dataStoreUID(this.data.uid, this.data); + set_prev_iframe_top(); } else { console.log('Can not resolve the winmail.data!'); } - }); + },dataElem)); } }