diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-16 14:08:14 +0300 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-16 14:08:14 +0300 |
commit | 923e6ca1bf1c26481ced77ded4cf04ad969c13ac (patch) | |
tree | db35760faa5c4730874344615875424b7acc0dbf | |
parent | 64fb704c4ea2490418a389a661dc5b8341667f78 (diff) | |
parent | e1d2ab83ccb5a6e671f024ebdd3dc329e82bb18e (diff) |
Merge pull request #19809 from owncloud/show-serverside-share-link-expiration-stable8.1
Update expiration date on link sharing
-rw-r--r-- | core/ajax/share.php | 8 | ||||
-rw-r--r-- | core/js/share.js | 7 |
2 files changed, 12 insertions, 3 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php index 4546217def3..c1eaa8ec260 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, false); + $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..79fcf61c215 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -1062,6 +1062,9 @@ $(document).ready(function() { $button.removeClass('hidden'); $button.prop('disabled', false); OC.Share.showLink(data.token, null, itemSource); + if (data.expiration) { + OC.Share.showExpirationDate(data.expiration); + } $('#dropdown').trigger(new $.Event('sharesChanged', {shares: OC.Share.currentShares})); OC.Share.updateIcon(itemType, itemSource); }); @@ -1202,6 +1205,10 @@ $(document).ready(function() { OC.Share.showLink(data.token, "password set", itemSource); OC.Share.updateIcon(itemType, itemSource); } + + if (data.expiration) { + OC.Share.showExpirationDate(data.expiration); + } $('#dropdown').trigger(new $.Event('sharesChanged', {shares: OC.Share.currentShares})); }, function(result) { $loading.addClass('hidden'); |