summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/ajax/undelete.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_trashbin/ajax/undelete.php')
-rw-r--r--apps/files_trashbin/ajax/undelete.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/files_trashbin/ajax/undelete.php b/apps/files_trashbin/ajax/undelete.php
index c5480348285..f55629d695c 100644
--- a/apps/files_trashbin/ajax/undelete.php
+++ b/apps/files_trashbin/ajax/undelete.php
@@ -7,7 +7,8 @@ if(!OC_User::isLoggedIn()) {
$timestamp = isset( $_REQUEST['timestamp'] ) ? $_REQUEST['timestamp'] : '';
$filename = isset( $_REQUEST['filename'] ) ? trim($_REQUEST['filename'], '/\\') : '';
-OCA_Trash\Trashbin::restore($filename, $timestamp);
-
-//TODO: return useful data after succsessful restore operation and remove restored files from the list view
-OCP\JSON::success(array("data" => array('content'=>'foo', 'id' => 'bar'))); \ No newline at end of file
+if ( OCA_Trash\Trashbin::restore($filename, $timestamp) ) {
+ OCP\JSON::success(array("data" => array('filename'=>$filename, 'timestamp' => $timestamp)));
+} else {
+ OCP\JSON::error(array("data" => array("message" => "Couldn't restore ".$filename)));
+}