mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-01 09:49:27 +00:00
(web) New menu option to move mailboxes
Fixes #644 Fixes #3511 Fixes #4479
This commit is contained in:
@@ -485,7 +485,7 @@
|
||||
/**
|
||||
* @function $rename
|
||||
* @memberof AddressBook.prototype
|
||||
* @desc Rename the addressbook and keep the list sorted
|
||||
* @desc Rename the mailbox and keep the list sorted
|
||||
* @param {string} name - the new name
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
@@ -827,6 +827,21 @@
|
||||
this.$shadowData = this.$omit();
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $move
|
||||
* @memberof Mailbox.prototype
|
||||
* @desc Move the mailbox to a different parent. Will reload the mailboxes list.
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
Mailbox.prototype.$move = function(parentPath) {
|
||||
var _this = this;
|
||||
|
||||
return Mailbox.$$resource.post(this.id, 'move', {parent: parentPath}).finally(function() {
|
||||
_this.$account.$getMailboxes({reload: true});
|
||||
return true;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $save
|
||||
* @memberof Mailbox.prototype
|
||||
|
||||
@@ -296,6 +296,37 @@
|
||||
});
|
||||
};
|
||||
|
||||
this.isParentOf = function(path) {
|
||||
var findChildren;
|
||||
|
||||
// Local recursive function
|
||||
findChildren = function(parent) {
|
||||
if (parent.children && parent.children.length > 0) {
|
||||
for (var i = 0, found = false; !found && i < parent.children.length; i++) {
|
||||
var o = parent.children[i];
|
||||
if (o.children && o.children.length > 0) {
|
||||
if (findChildren(o)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (o.path == path) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return (parent.path == path);
|
||||
}
|
||||
};
|
||||
|
||||
return findChildren(this.folder);
|
||||
};
|
||||
|
||||
this.moveFolder = function(path) {
|
||||
this.folder.$move(path);
|
||||
mdPanelRef.close();
|
||||
};
|
||||
|
||||
} // MenuController
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user