From ec388c955acd913ca16bb8870bb82b0fb058d2f4 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 5 Oct 2022 14:30:43 -0600 Subject: [PATCH] Fix open compose windows created new drafts after main window was reloaded --- api/js/jsapi/egw.js | 4 +--- mail/js/app.js | 7 ++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/api/js/jsapi/egw.js b/api/js/jsapi/egw.js index 3b3ec38378..b0ed9aa6a7 100644 --- a/api/js/jsapi/egw.js +++ b/api/js/jsapi/egw.js @@ -488,8 +488,7 @@ window.egw_rejoin = function () { opener.addEventListener("load", () => { - /* It takes more than just re-setting this.framework to get things working again - + /* It takes more than just re-setting this.framework to get everything working again, but this helps */ let reconnecting = egw(this).message("Reconnecting..."); window.setTimeout(() => { @@ -499,7 +498,6 @@ window.egw_rejoin = function () this.framework = this.opener.framework; this.framework.egw_appWindow().console.log("Popup %s rejoined", this.location.href); }, 5000); - */ }); }.bind(window), 500); } \ No newline at end of file diff --git a/mail/js/app.js b/mail/js/app.js index 8107fc5fe2..d9562209e9 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -3906,9 +3906,10 @@ app.classes.mail = AppJS.extend( } else { - - self.egw.json('mail.mail_compose.ajax_saveAsDraft',[content, action],function(_data){ - var res = self.savingDraft_response(_data,action); + // Send request through framework main window, so it works even if the main window is reloaded + framework.egw_appWindow().egw.json('mail.mail_compose.ajax_saveAsDraft', [content, action], function (_data) + { + var res = self.savingDraft_response(_data, action); if (res) { _resolve();