Expunge mailbox on specific actions

Current mailbox is now expunged when leaving the Mail module. The drafts
mailbox is also expunged when a message is sent.
pull/27/merge
Francis Lachapelle 2016-07-27 11:56:28 -04:00
parent f1d2bcffc8
commit 80338daf91
3 changed files with 27 additions and 6 deletions

2
NEWS
View File

@ -10,6 +10,7 @@ Enhancements
- [web] notify when successfuly copied or moved some messages - [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] 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] removed animation when dragging an event to speed up rendering
- [web] expunge drafts mailbox when a draft is sent and deleted
Bug fixes Bug fixes
- [web] fixed refresh of addressbook when deleting one or many cards - [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 printing of long mail (#3731)
- [web] fixed position of ghost block when creating an event from DnD - [web] fixed position of ghost block when creating an event from DnD
- [web] fixed avatar image in autocompletion - [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) - [eas] fixed long GUID issue preventing sometimes synchronisation (#3460)
3.1.4 (2016-07-12) 3.1.4 (2016-07-12)

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2007-2014 Inverse inc. Copyright (C) 2007-2016 Inverse inc.
Copyright (C) 2004-2005 SKYRIX Software AG Copyright (C) 2004-2005 SKYRIX Software AG
This file is part of SOGo. This file is part of SOGo.
@ -63,6 +63,7 @@
#import "NSData+Mail.h" #import "NSData+Mail.h"
#import "NSString+Mail.h" #import "NSString+Mail.h"
#import "SOGoDraftsFolder.h"
#import "SOGoMailAccount.h" #import "SOGoMailAccount.h"
#import "SOGoMailObject+Draft.h" #import "SOGoMailObject+Draft.h"
#import "SOGoSentFolder.h" #import "SOGoSentFolder.h"
@ -1970,8 +1971,16 @@ static NSString *userAgent = nil;
} }
} }
if (!error && ![dd mailKeepDraftsAfterSend]) // Expunge Drafts mailbox if
[self delete]; // - 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; return error;
} }

View File

@ -6,11 +6,11 @@
/** /**
* @ngInject * @ngInject
*/ */
MailboxController.$inject = ['$window', '$timeout', '$q', '$state', '$mdDialog', '$mdToast', 'stateAccounts', 'stateAccount', 'stateMailbox', 'encodeUriFilter', 'sgFocus', 'Dialog', 'Account', 'Mailbox']; MailboxController.$inject = ['$window', '$scope', '$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) { function MailboxController($window, $scope, $timeout, $q, $state, $mdDialog, $mdToast, stateAccounts, stateAccount, stateMailbox, encodeUriFilter, focus, Dialog, Account, Mailbox) {
var vm = this, messageDialog = null; var vm = this, messageDialog = null;
// Expose controller // Expose controller for eventual popup windows
$window.$mailboxController = vm; $window.$mailboxController = vm;
stateMailbox.selectFolder(); stateMailbox.selectFolder();
@ -36,6 +36,16 @@
vm.selectAll = selectAll; vm.selectAll = selectAll;
vm.unselectMessages = unselectMessages; 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) { function sort(field) {
vm.selectedFolder.$filter({ sort: field }); vm.selectedFolder.$filter({ sort: field });
} }