snappymail/dev/Promises/User/Ajax.js
RainLoop Team e5af98b04b Update ckeditor
Move e2e tests
Code refactoring
2016-09-12 23:50:21 +03:00

64 lines
1.5 KiB
JavaScript

import window from 'window';
import PromisesPopulator from 'Promises/User/Populator';
import {AbstractAjaxPromises} from 'Promises/AbstractAjax';
class UserAjaxUserPromises extends AbstractAjaxPromises
{
constructor() {
super();
this.foldersTimeout = 0;
}
foldersReload(fTrigger) {
return this.abort('Folders').postRequest('Folders', fTrigger).then((data) => {
PromisesPopulator.foldersList(data.Result);
PromisesPopulator.foldersAdditionalParameters(data.Result);
return true;
});
}
foldersReloadWithTimeout(fTrigger) {
this.setTrigger(fTrigger, true);
window.clearTimeout(this.foldersTimeout);
this.foldersTimeout = window.setTimeout(() => {
this.foldersReload(fTrigger);
}, 500);
}
folderDelete(sFolderFullNameRaw, fTrigger) {
return this.postRequest('FolderDelete', fTrigger, {
'Folder': sFolderFullNameRaw
});
}
folderCreate(sNewFolderName, sParentName, fTrigger) {
return this.postRequest('FolderCreate', fTrigger, {
'Folder': sNewFolderName,
'Parent': sParentName
});
}
folderRename(sPrevFolderFullNameRaw, sNewFolderName, fTrigger) {
return this.postRequest('FolderRename', fTrigger, {
'Folder': sPrevFolderFullNameRaw,
'NewFolderName': sNewFolderName
});
}
attachmentsActions(sAction, aHashes, fTrigger) {
return this.postRequest('AttachmentsActions', fTrigger, {
'Do': sAction,
'Hashes': aHashes
});
}
welcomeClose() {
return this.postRequest('WelcomeClose');
}
}
export default new UserAjaxUserPromises();