diff options
author | Robin Appelman <robin@icewind.nl> | 2018-09-04 14:12:47 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2018-09-20 17:03:44 +0200 |
commit | a7a06b2349979cd26d7f0f70ecc03a6848834294 (patch) | |
tree | 8f98086d5bbda5faa8d5ebf572cf4a0f62dd5006 /apps/files_trashbin/js/app.js | |
parent | 0c6e154b5044592122ad3c03bdd607e186c2f24e (diff) | |
download | nextcloud-server-a7a06b2349979cd26d7f0f70ecc03a6848834294.tar.gz nextcloud-server-a7a06b2349979cd26d7f0f70ecc03a6848834294.zip |
use dav trashbin api for restore
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_trashbin/js/app.js')
-rw-r--r-- | apps/files_trashbin/js/app.js | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/apps/files_trashbin/js/app.js b/apps/files_trashbin/js/app.js index 78a1c02f78a..82e47d510bf 100644 --- a/apps/files_trashbin/js/app.js +++ b/apps/files_trashbin/js/app.js @@ -76,14 +76,16 @@ OCA.Trashbin.App = { actionHandler: function (filename, context) { var fileList = context.fileList; var tr = fileList.findFileEl(filename); - var deleteAction = tr.children("td.date").children(".action.delete"); - deleteAction.removeClass('icon-delete').addClass('icon-loading-small'); - $.post(OC.filePath('files_trashbin', 'ajax', 'undelete.php'), { - files: JSON.stringify([filename]), - dir: fileList.getCurrentDirectory() - }, - _.bind(fileList._removeCallback, fileList) - ); + fileList.showFileBusyState(tr, true); + var dir = context.fileList.getCurrentDirectory(); + client.move(OC.joinPaths('trash', dir, filename), OC.joinPaths('restore', filename), true) + .then( + fileList._removeCallback.bind(fileList, [filename]), + function () { + fileList.showFileBusyState(tr, false); + OC.Notification.show(t('files_trashbin', 'Error while restoring file from trashbin')); + } + ); } }); @@ -104,12 +106,13 @@ OCA.Trashbin.App = { var fileList = context.fileList; $('.tipsy').remove(); var tr = fileList.findFileEl(filename); - var deleteAction = tr.children("td.date").children(".action.delete"); - deleteAction.removeClass('icon-delete').addClass('icon-loading-small'); - client.remove('trash/' + filename) + fileList.showFileBusyState(tr, true); + var dir = context.fileList.getCurrentDirectory(); + client.remove(OC.joinPaths('trash', dir, filename)) .then( fileList._removeCallback.bind(fileList, [filename]), function () { + fileList.showFileBusyState(tr, false); OC.Notification.show(t('files_trashbin', 'Error while removing file from trashbin')); } ); |