summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-03-20 23:17:25 +0100
committerGitHub <noreply@github.com>2018-03-20 23:17:25 +0100
commit52a97e826ba8f84bd4eb60b837c6f57c8b0c373b (patch)
tree9be6113a98fe7a68ad1c2d2862bdb5fb3ead9486
parentd9f512e593c3e3f927a77a5b0f2619b835d9a49b (diff)
parent3bd92edd9cff16f4304e526d57fa71f6ecfb3ca0 (diff)
downloadnextcloud-server-52a97e826ba8f84bd4eb60b837c6f57c8b0c373b.tar.gz
nextcloud-server-52a97e826ba8f84bd4eb60b837c6f57c8b0c373b.zip
Merge pull request #8905 from nextcloud/stable13-8843-set-share-with-field-to-the-id-of-the-circle
[stable13] Set "share with" field to the ID of the circle
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php12
-rw-r--r--core/js/sharedialogshareelistview.js2
-rw-r--r--core/js/sharedialogview.js2
3 files changed, 12 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index 10876e16568..82a93c446e2 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -200,8 +200,16 @@ class ShareAPIController extends OCSController {
$result['share_with_displayname'] = $this->getDisplayNameFromAddressBook($share->getSharedWith(), 'EMAIL');
$result['token'] = $share->getToken();
} else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_CIRCLE) {
- $result['share_with_displayname'] = $share->getSharedWith();
- $result['share_with'] = explode(' ', $share->getSharedWith(), 2)[0];
+ // getSharedWith() returns either "name (type, owner)" or
+ // "name (type, owner) [id]", depending on the Circles app version.
+ $hasCircleId = (substr($share->getSharedWith(), -1) === ']');
+
+ $displayNameLength = ($hasCircleId? strrpos($share->getSharedWith(), ' '): strlen($share->getSharedWith()));
+ $result['share_with_displayname'] = substr($share->getSharedWith(), 0, $displayNameLength);
+
+ $shareWithStart = ($hasCircleId? strrpos($share->getSharedWith(), '[') + 1: 0);
+ $shareWithLength = ($hasCircleId? -1: strpos($share->getSharedWith(), ' '));
+ $result['share_with'] = substr($share->getSharedWith(), $shareWithStart, $shareWithLength);
}
diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js
index 6c256d3de37..8ec53810b51 100644
--- a/core/js/sharedialogshareelistview.js
+++ b/core/js/sharedialogshareelistview.js
@@ -241,7 +241,7 @@
shareWithTitle: shareWithTitle,
shareType: shareType,
shareId: this.model.get('shares')[shareIndex].id,
- modSeed: shareType !== OC.Share.SHARE_TYPE_USER,
+ modSeed: shareType !== OC.Share.SHARE_TYPE_USER && shareType !== OC.Share.SHARE_TYPE_CIRCLE,
isRemoteShare: shareType === OC.Share.SHARE_TYPE_REMOTE,
isMailShare: shareType === OC.Share.SHARE_TYPE_EMAIL,
isCircleShare: shareType === OC.Share.SHARE_TYPE_CIRCLE,
diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js
index 6b65e46b254..d2c63490141 100644
--- a/core/js/sharedialogview.js
+++ b/core/js/sharedialogview.js
@@ -338,7 +338,7 @@
}
var insert = $("<div class='share-autocomplete-item'/>");
var avatar = $("<div class='avatardiv'></div>").appendTo(insert);
- if (item.value.shareType === OC.Share.SHARE_TYPE_USER) {
+ if (item.value.shareType === OC.Share.SHARE_TYPE_USER || item.value.shareType === OC.Share.SHARE_TYPE_CIRCLE) {
avatar.avatar(item.value.shareWith, 32, undefined, undefined, undefined, item.label);
} else {
avatar.imageplaceholder(text, undefined, 32);