(js) Improve popup window detection in mailer

Fixes #4518
pull/229/merge
Francis Lachapelle 2018-07-31 09:11:45 -04:00
parent 0feddfc7af
commit 7f135e5323
2 changed files with 10 additions and 2 deletions

1
NEWS
View File

@ -9,6 +9,7 @@ Enhancements
Bug fixes
- [core] handle multi-valued mozillasecondemail attribute mapping
- [web] improve popup window detection in message viewer (#4518)
4.0.1 (2018-07-10)
------------------

View File

@ -11,6 +11,8 @@
var vm = this, popupWindow = null, hotkeys = [];
this.$onInit = function() {
var isPopupWindow = false;
// Expose controller
$window.$messageController = vm;
@ -30,9 +32,14 @@
_registerHotkeys(hotkeys);
// Detect if this is message appears in a separate window
try {
isPopupWindow = $window.opener && '$mailboxController' in $window.opener;
}
catch (e) {}
// One-way refresh of the parent window when modifying the message from a popup window.
if ($window.opener &&
'$mailboxController' in $window.opener) {
if (isPopupWindow) {
// Update the message flags. The message must be displayed in the parent window.
$scope.$watchCollection(function() { return vm.message.flags; }, function(newTags, oldTags) {
var ctrls;