mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-18 11:38:53 +00:00
Webmail: add reply button
This commit is contained in:
@@ -48,6 +48,10 @@
|
||||
return Mailbox; // return constructor
|
||||
}];
|
||||
|
||||
/**
|
||||
* @module SOGo.MailerUI
|
||||
* @desc Factory registration of Card in Angular module.
|
||||
*/
|
||||
angular.module('SOGo.MailerUI')
|
||||
/* Factory constants */
|
||||
.constant('sgMailbox_PRELOAD', {
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
this.uid = uid;
|
||||
this.id = this.$absolutePath();
|
||||
if (oldUID > -1) {
|
||||
// For new messages, $mailbox doesn't exist
|
||||
this.$mailbox.uidsMap[uid] = this.$mailbox.uidsMap[oldUID];
|
||||
this.$mailbox.uidsMap[oldUID] = null;
|
||||
}
|
||||
@@ -170,6 +171,39 @@
|
||||
return this.$unwrap(futureMessageData);
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $reply
|
||||
* @memberof Message.prototype
|
||||
* @desc Prepare a new Message object as the reply of the current message and associated to the draft mailbox.
|
||||
* @see {@link Account.$newMessage}
|
||||
* @returns a promise of the HTTP operations
|
||||
*/
|
||||
Message.prototype.$reply = function() {
|
||||
var _this = this,
|
||||
deferred = Message.$q.defer(),
|
||||
mailbox,
|
||||
message;
|
||||
|
||||
// Query server for draft folder and draft UID
|
||||
Message.$$resource.fetch(this.id, 'reply').then(function(data) {
|
||||
Message.$log.debug('New reply: ' + JSON.stringify(data, undefined, 2));
|
||||
mailbox = _this.$mailbox.$account.$getMailboxByPath(data.mailboxPath);
|
||||
message = new Message(data.accountId, mailbox, data);
|
||||
// Fetch draft initial data
|
||||
Message.$$resource.fetch(message.$absolutePath({asDraft: true}), 'edit').then(function(data) {
|
||||
Message.$log.debug('New reply: ' + JSON.stringify(data, undefined, 2));
|
||||
message.editable = data;
|
||||
deferred.resolve(message);
|
||||
}, function(data) {
|
||||
deferred.reject(data);
|
||||
});
|
||||
}, function(data) {
|
||||
deferred.reject(data);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $save
|
||||
* @memberof Message.prototype
|
||||
|
||||
Reference in New Issue
Block a user