mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-09-13 01:18:04 +00:00
Improve JavaScript of Mail module
- activated file uploader of mail editor - renamed method $update to $reload - automatically mark messages as read - use ui-sref-active from ui-router instead of ng-class
This commit is contained in:
@@ -149,12 +149,12 @@
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $update
|
||||
* @function $reload
|
||||
* @memberof Mailbox.prototype
|
||||
* @desc Fetch the messages metadata of the mailbox.
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
Mailbox.prototype.$update = function() {
|
||||
Mailbox.prototype.$reload = function() {
|
||||
var futureMailboxData;
|
||||
|
||||
futureMailboxData = Mailbox.$$resource.post(this.id, 'view', {sortingAttributes: {sort: 'date', asc: false}});
|
||||
|
||||
@@ -157,12 +157,12 @@
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $update
|
||||
* @function $reload
|
||||
* @memberof Message.prototype
|
||||
* @desc Fetch the viewable message body along with other metadata such as the list of attachments.
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
Message.prototype.$update = function() {
|
||||
Message.prototype.$reload = function() {
|
||||
var futureMessageData;
|
||||
|
||||
futureMessageData = Message.$$resource.fetch(this.id, 'view');
|
||||
@@ -191,7 +191,7 @@
|
||||
return Message.$$resource.save(this.$absolutePath({asDraft: true}), data).then(function(response) {
|
||||
Message.$log.debug('save = ' + JSON.stringify(response, undefined, 2));
|
||||
_this.$setUID(response.uid);
|
||||
_this.$update(); // fetch a new viewable version of the message
|
||||
_this.$reload(); // fetch a new viewable version of the message
|
||||
});
|
||||
};
|
||||
|
||||
@@ -247,6 +247,13 @@
|
||||
_this.$formatFullAddresses();
|
||||
deferred.resolve(_this);
|
||||
});
|
||||
if (!_this.isread) {
|
||||
Message.$$resource.fetch(_this.id, 'markMessageRead').then(function() {
|
||||
Message.$timeout(function() {
|
||||
_this.isread = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
}, function(data) {
|
||||
angular.extend(_this, data);
|
||||
_this.isError = true;
|
||||
|
||||
Reference in New Issue
Block a user