diff --git a/NEWS b/NEWS index ba7749385..a24db3d0b 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,7 @@ Enhancements - [web] notify when successfuly copied or moved some messages - [web] restored indicator in the top banner when a vacation message (auto-reply) is active - [web] removed animation when dragging an event to speed up rendering + - [web] expunge drafts mailbox when a draft is sent and deleted Bug fixes - [web] fixed refresh of addressbook when deleting one or many cards @@ -18,6 +19,7 @@ Bug fixes - [web] fixed printing of long mail (#3731) - [web] fixed position of ghost block when creating an event from DnD - [web] fixed avatar image in autocompletion + - [web] restored expunge of current mailbox when leaving the Mail module - [eas] fixed long GUID issue preventing sometimes synchronisation (#3460) 3.1.4 (2016-07-12) diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index f13243e2b..caf0f6363 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2007-2014 Inverse inc. + Copyright (C) 2007-2016 Inverse inc. Copyright (C) 2004-2005 SKYRIX Software AG This file is part of SOGo. @@ -63,6 +63,7 @@ #import "NSData+Mail.h" #import "NSString+Mail.h" +#import "SOGoDraftsFolder.h" #import "SOGoMailAccount.h" #import "SOGoMailObject+Draft.h" #import "SOGoSentFolder.h" @@ -1970,8 +1971,16 @@ static NSString *userAgent = nil; } } - if (!error && ![dd mailKeepDraftsAfterSend]) - [self delete]; + // Expunge Drafts mailbox if + // - message was sent and saved to Sent mailbox if necessary; + // - SOGoMailKeepDraftsAfterSend is not set; + // - draft is successfully deleted; + // - drafts mailbox exists. + if (!error && + ![dd mailKeepDraftsAfterSend] && + ![self delete] && + [imap4 doesMailboxExistAtURL: [container imap4URL]]) + [(SOGoDraftsFolder *) container expunge]; return error; } diff --git a/UI/WebServerResources/js/Mailer/MailboxController.js b/UI/WebServerResources/js/Mailer/MailboxController.js index 0eb03b3e4..01421a1bd 100644 --- a/UI/WebServerResources/js/Mailer/MailboxController.js +++ b/UI/WebServerResources/js/Mailer/MailboxController.js @@ -6,11 +6,11 @@ /** * @ngInject */ - MailboxController.$inject = ['$window', '$timeout', '$q', '$state', '$mdDialog', '$mdToast', 'stateAccounts', 'stateAccount', 'stateMailbox', 'encodeUriFilter', 'sgFocus', 'Dialog', 'Account', 'Mailbox']; - function MailboxController($window, $timeout, $q, $state, $mdDialog, $mdToast, stateAccounts, stateAccount, stateMailbox, encodeUriFilter, focus, Dialog, Account, Mailbox) { + MailboxController.$inject = ['$window', '$scope', '$timeout', '$q', '$state', '$mdDialog', '$mdToast', 'stateAccounts', 'stateAccount', 'stateMailbox', 'encodeUriFilter', 'sgFocus', 'Dialog', 'Account', 'Mailbox']; + function MailboxController($window, $scope, $timeout, $q, $state, $mdDialog, $mdToast, stateAccounts, stateAccount, stateMailbox, encodeUriFilter, focus, Dialog, Account, Mailbox) { var vm = this, messageDialog = null; - // Expose controller + // Expose controller for eventual popup windows $window.$mailboxController = vm; stateMailbox.selectFolder(); @@ -36,6 +36,16 @@ vm.selectAll = selectAll; vm.unselectMessages = unselectMessages; + // Expunge mailbox when leaving the Mail module + angular.element($window).on('beforeunload', _compactBeforeUnload); + $scope.$on('$destroy', function() { + angular.element($window).off('beforeunload', _compactBeforeUnload); + }); + + function _compactBeforeUnload(event) { + return vm.selectedFolder.$compact(); + } + function sort(field) { vm.selectedFolder.$filter({ sort: field }); }