mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-07 04:47:14 +00:00
Webmail: Add forward button to messages
This commit is contained in:
1 parent
225c998a97
commit
c514cb64bc
3 files changed
+58
-9
No files matched your search
@@ -174,24 +174,59 @@
|
||||
/**
|
||||
* @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}
|
||||
* @desc Prepare a new Message object as a reply to the sender.
|
||||
* @returns a promise of the HTTP operations
|
||||
*/
|
||||
Message.prototype.$reply = function() {
|
||||
return this.$newDraft('reply');
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $replyAll
|
||||
* @memberof Message.prototype
|
||||
* @desc Prepare a new Message object as a reply to the sender and all recipients.
|
||||
* @returns a promise of the HTTP operations
|
||||
*/
|
||||
Message.prototype.$replyAll = function() {
|
||||
return this.$newDraft('replyall');
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $forward
|
||||
* @memberof Message.prototype
|
||||
* @desc Prepare a new Message object as a forward.
|
||||
* @returns a promise of the HTTP operations
|
||||
*/
|
||||
Message.prototype.$forward = function() {
|
||||
return this.$newDraft('forward');
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $newDraft
|
||||
* @memberof Message.prototype
|
||||
* @desc Prepare a new Message object as a reply or a forward of the current message and associated
|
||||
* to the draft mailbox.
|
||||
* @see {@link Account.$newMessage}
|
||||
* @see {@link Message.$editableContent}
|
||||
* @see {@link Message.$reply}
|
||||
* @see {@link Message.$replyAll}
|
||||
* @see {@link Message.$forwad}
|
||||
* @returns a promise of the HTTP operations
|
||||
*/
|
||||
Message.prototype.$newDraft = function(action) {
|
||||
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));
|
||||
Message.$$resource.fetch(this.id, action).then(function(data) {
|
||||
Message.$log.debug('New ' + action + ': ' + 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.$log.debug('New ' + action + ': ' + JSON.stringify(data, undefined, 2));
|
||||
message.editable = data;
|
||||
deferred.resolve(message);
|
||||
}, function(data) {
|
||||
|
||||
Reference in new issue
Block a user