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
This commit is contained in:
commit
52a97e826b
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue