aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-10-15 15:23:50 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-10-15 15:23:50 +0200
commita2810f620774a0b8854f78f01f7f36f439ef06f0 (patch)
tree57d5843c6a3e43aa3210b73fcba3145d27a13c41
parent4d92aa551dc78a9557008df7ebd0db1f1abbd1d7 (diff)
downloadnextcloud-server-a2810f620774a0b8854f78f01f7f36f439ef06f0.tar.gz
nextcloud-server-a2810f620774a0b8854f78f01f7f36f439ef06f0.zip
Update expiration date on link sharing
-rw-r--r--core/ajax/share.php8
-rw-r--r--core/js/share.js1
2 files changed, 6 insertions, 3 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index 4546217def3..089f85a8d58 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -62,11 +62,13 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
(!empty($_POST['expirationDate']) ? new \DateTime((string)$_POST['expirationDate']) : null)
);
+ $response = [];
if (is_string($token)) {
- OC_JSON::success(array('data' => array('token' => $token)));
- } else {
- OC_JSON::success();
+ $item = OCP\Share::getShareByToken($token);
+ $response['data'] = array('token' => $token,
+ 'expiration' => $item['expiration']);
}
+ OC_JSON::success($response);
} catch (\OC\HintException $exception) {
OC_JSON::error(array('data' => array('message' => $exception->getHint())));
} catch (Exception $exception) {
diff --git a/core/js/share.js b/core/js/share.js
index af654e6dedc..904a51919e3 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -1062,6 +1062,7 @@ $(document).ready(function() {
$button.removeClass('hidden');
$button.prop('disabled', false);
OC.Share.showLink(data.token, null, itemSource);
+ OC.Share.showExpirationDate(data.expiration);
$('#dropdown').trigger(new $.Event('sharesChanged', {shares: OC.Share.currentShares}));
OC.Share.updateIcon(itemType, itemSource);
});