Skip to content

Commit 1c1349f

Browse files
committed
Use Promise to enable waiting for the decision from the dialog
1 parent 226f065 commit 1c1349f

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

program/js/app.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7870,12 +7870,29 @@ function rcube_webmail() {
78707870
newname = to === '' || to === '*' ? basename : to + this.env.delimiter + basename;
78717871

78727872
if (newname != from) {
7873-
this.confirm_dialog(this.get_label('movefolderconfirm'), 'move', function () {
7874-
ref.http_post('rename-folder', { _folder_oldname: from, _folder_newname: newname },
7875-
ref.set_busy(true, 'foldermoving'));
7876-
}, { button_class: 'save move' });
7873+
return new Promise((resolve, _reject) => {
7874+
this.confirm_dialog(
7875+
this.get_label('movefolderconfirm'),
7876+
'move',
7877+
function () {
7878+
ref.http_post('rename-folder',
7879+
{
7880+
_folder_oldname: from,
7881+
_folder_newname: newname,
7882+
},
7883+
ref.set_busy(true, 'foldermoving')
7884+
);
7885+
resolve(true);
7886+
},
7887+
{
7888+
button_class: 'save move',
7889+
cancel_func: (e, ref) => resolve(false),
7890+
}
7891+
);
7892+
});
78777893
}
78787894
}
7895+
return Promise.resolve(true);
78797896
};
78807897

78817898
// tell server to create and subscribe a new mailbox

0 commit comments

Comments
 (0)