Browse Source
Merge pull request #8843 from nextcloud/set-share-with-field-to-the-id-of-the-circle
Set "share with" field to the ID of the circle
pull/8864/head
blizzz
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
12 additions and
4 deletions
-
apps/files_sharing/lib/Controller/ShareAPIController.php
-
core/js/sharedialogshareelistview.js
-
core/js/sharedialogview.js
|
|
|
@ -207,8 +207,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); |
|
|
|
|