a9ad21b395
We now call the model's methods from the template. Uncluttered the message controller. Fixed the synchronization of the flags with the messages list.
30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
(function() {
|
|
'use strict';
|
|
|
|
/**
|
|
* @ngInject
|
|
*/
|
|
MessageController.$inject = ['$scope', '$rootScope', '$stateParams', '$state', 'stateAccount', 'stateMailbox', 'stateMessage', '$timeout', 'encodeUriFilter', 'sgFocus', 'Dialog', 'Account', 'Mailbox'];
|
|
function MessageController($scope, $rootScope, $stateParams, $state, stateAccount, stateMailbox, stateMessage, $timeout, encodeUriFilter, focus, Dialog, Account, Mailbox) {
|
|
$rootScope.message = stateMessage;
|
|
$scope.tags = {};
|
|
$scope.doDelete = function() {
|
|
stateMailbox.$deleteMessages([stateMessage.uid]).then(function() {
|
|
// Remove message from list of messages
|
|
stateMailbox.$messages = _.reject(stateMailbox.$messages, function(o) {
|
|
return o.uid == stateMessage.uid;
|
|
});
|
|
// Remove message object from scope
|
|
$rootScope.message = null;
|
|
$state.go('mail.account.mailbox', { accountId: stateAccount.id, mailboxId: encodeUriFilter(stateMailbox.path) });
|
|
});
|
|
};
|
|
}
|
|
|
|
angular
|
|
.module('SOGo.MailerUI')
|
|
.controller('MessageController', MessageController);
|
|
})();
|