Show unique displayname context in the user share list entries
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
3666754be7
commit
61b574b130
|
@ -235,6 +235,9 @@ class ShareAPIController extends OCSController {
|
||||||
$sharedWith = $this->userManager->get($share->getSharedWith());
|
$sharedWith = $this->userManager->get($share->getSharedWith());
|
||||||
$result['share_with'] = $share->getSharedWith();
|
$result['share_with'] = $share->getSharedWith();
|
||||||
$result['share_with_displayname'] = $sharedWith !== null ? $sharedWith->getDisplayName() : $share->getSharedWith();
|
$result['share_with_displayname'] = $sharedWith !== null ? $sharedWith->getDisplayName() : $share->getSharedWith();
|
||||||
|
$result['share_with_displayname_unique'] = $sharedWith !== null ? (
|
||||||
|
$sharedWith->getEMailAddress() !== '' ? $sharedWith->getEMailAddress() : $sharedWith->getUID()
|
||||||
|
) : $share->getSharedWith();
|
||||||
$result['status'] = [];
|
$result['status'] = [];
|
||||||
|
|
||||||
$userStatuses = $this->userStatusManager->getUserStatuses([$share->getSharedWith()]);
|
$userStatuses = $this->userStatusManager->getUserStatuses([$share->getSharedWith()]);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
:menu-position="'left'"
|
:menu-position="'left'"
|
||||||
:url="share.shareWithAvatar" />
|
:url="share.shareWithAvatar" />
|
||||||
<div v-tooltip.auto="tooltip" class="sharing-entry__desc">
|
<div v-tooltip.auto="tooltip" class="sharing-entry__desc">
|
||||||
<h5>{{ title }}</h5>
|
<h5>{{ title }}<span v-if="!isUnique" class="sharing-entry__desc-unique"> ({{ share.shareWithDisplayNameUnique }})</span></h5>
|
||||||
<p v-if="hasStatus">
|
<p v-if="hasStatus">
|
||||||
<span>{{ share.status.icon || '' }}</span>
|
<span>{{ share.status.icon || '' }}</span>
|
||||||
<span>{{ share.status.message || '' }}</span>
|
<span>{{ share.status.message || '' }}</span>
|
||||||
|
@ -399,6 +399,9 @@ export default {
|
||||||
p {
|
p {
|
||||||
color: var(--color-text-maxcontrast);
|
color: var(--color-text-maxcontrast);
|
||||||
}
|
}
|
||||||
|
&-unique {
|
||||||
|
color: var(--color-text-maxcontrast);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&__actions {
|
&__actions {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
|
|
|
@ -64,6 +64,10 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
isUnique: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,10 @@ export default {
|
||||||
type: Share,
|
type: Share,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
isUnique: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
|
|
@ -150,6 +150,10 @@ export default class Share {
|
||||||
|| this.#share.share_with
|
|| this.#share.share_with
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get shareWithDisplayNameUnique() {
|
||||||
|
return this.#share.share_with_displayname_unique || this.#share.share_with
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the share with avatar if any
|
* Get the share with avatar if any
|
||||||
*
|
*
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
:key="share.id"
|
:key="share.id"
|
||||||
:file-info="fileInfo"
|
:file-info="fileInfo"
|
||||||
:share="share"
|
:share="share"
|
||||||
|
:is-unique="isUnique(share)"
|
||||||
@remove:share="removeShare" />
|
@remove:share="removeShare" />
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
import Share from '../models/Share'
|
import Share from '../models/Share'
|
||||||
import SharingEntry from '../components/SharingEntry'
|
import SharingEntry from '../components/SharingEntry'
|
||||||
|
import ShareTypes from '../mixins/ShareTypes'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SharingList',
|
name: 'SharingList',
|
||||||
|
@ -42,6 +44,8 @@ export default {
|
||||||
SharingEntry,
|
SharingEntry,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mixins: [ShareTypes],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
fileInfo: {
|
fileInfo: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -59,6 +63,13 @@ export default {
|
||||||
hasShares() {
|
hasShares() {
|
||||||
return this.shares.length === 0
|
return this.shares.length === 0
|
||||||
},
|
},
|
||||||
|
isUnique() {
|
||||||
|
return (share) => {
|
||||||
|
return [...this.shares].filter((item) => {
|
||||||
|
return share.type === this.SHARE_TYPES.SHARE_TYPE_USER && share.shareWithDisplayName === item.shareWithDisplayName
|
||||||
|
}).length <= 1
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -583,6 +583,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'share_type' => IShare::TYPE_USER,
|
'share_type' => IShare::TYPE_USER,
|
||||||
'share_with' => 'userId',
|
'share_with' => 'userId',
|
||||||
'share_with_displayname' => 'userDisplay',
|
'share_with_displayname' => 'userDisplay',
|
||||||
|
'share_with_displayname_unique' => 'userId@example.com',
|
||||||
'uid_owner' => 'initiatorId',
|
'uid_owner' => 'initiatorId',
|
||||||
'displayname_owner' => 'initiatorDisplay',
|
'displayname_owner' => 'initiatorDisplay',
|
||||||
'item_type' => 'file',
|
'item_type' => 'file',
|
||||||
|
@ -782,6 +783,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$user = $this->getMockBuilder(IUser::class)->getMock();
|
$user = $this->getMockBuilder(IUser::class)->getMock();
|
||||||
$user->method('getUID')->willReturn('userId');
|
$user->method('getUID')->willReturn('userId');
|
||||||
$user->method('getDisplayName')->willReturn('userDisplay');
|
$user->method('getDisplayName')->willReturn('userDisplay');
|
||||||
|
$user->method('getEMailAddress')->willReturn('userId@example.com');
|
||||||
|
|
||||||
$group = $this->getMockBuilder('OCP\IGroup')->getMock();
|
$group = $this->getMockBuilder('OCP\IGroup')->getMock();
|
||||||
$group->method('getGID')->willReturn('groupId');
|
$group->method('getGID')->willReturn('groupId');
|
||||||
|
@ -3440,6 +3442,8 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
$initiator->method('getDisplayName')->willReturn('initiatorDN');
|
$initiator->method('getDisplayName')->willReturn('initiatorDN');
|
||||||
$recipient = $this->getMockBuilder(IUser::class)->getMock();
|
$recipient = $this->getMockBuilder(IUser::class)->getMock();
|
||||||
$recipient->method('getDisplayName')->willReturn('recipientDN');
|
$recipient->method('getDisplayName')->willReturn('recipientDN');
|
||||||
|
$recipient->method('getEmailAddress')->willReturn('recipient');
|
||||||
|
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
|
@ -3479,6 +3483,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'file_target' => 'myTarget',
|
'file_target' => 'myTarget',
|
||||||
'share_with' => 'recipient',
|
'share_with' => 'recipient',
|
||||||
'share_with_displayname' => 'recipient',
|
'share_with_displayname' => 'recipient',
|
||||||
|
'share_with_displayname_unique' => 'recipient',
|
||||||
'note' => 'personal note',
|
'note' => 'personal note',
|
||||||
'label' => null,
|
'label' => null,
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
|
@ -3516,6 +3521,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'file_target' => 'myTarget',
|
'file_target' => 'myTarget',
|
||||||
'share_with' => 'recipient',
|
'share_with' => 'recipient',
|
||||||
'share_with_displayname' => 'recipientDN',
|
'share_with_displayname' => 'recipientDN',
|
||||||
|
'share_with_displayname_unique' => 'recipient',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myMimeType',
|
'mimetype' => 'myMimeType',
|
||||||
'has_preview' => false,
|
'has_preview' => false,
|
||||||
|
@ -3567,6 +3573,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'file_target' => 'myTarget',
|
'file_target' => 'myTarget',
|
||||||
'share_with' => 'recipient',
|
'share_with' => 'recipient',
|
||||||
'share_with_displayname' => 'recipient',
|
'share_with_displayname' => 'recipient',
|
||||||
|
'share_with_displayname_unique' => 'recipient',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myMimeType',
|
'mimetype' => 'myMimeType',
|
||||||
'has_preview' => false,
|
'has_preview' => false,
|
||||||
|
@ -3614,6 +3621,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'file_target' => 'myTarget',
|
'file_target' => 'myTarget',
|
||||||
'share_with' => 'recipient',
|
'share_with' => 'recipient',
|
||||||
'share_with_displayname' => 'recipient',
|
'share_with_displayname' => 'recipient',
|
||||||
|
'share_with_displayname_unique' => 'recipient',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'myMimeType',
|
'mimetype' => 'myMimeType',
|
||||||
'has_preview' => false,
|
'has_preview' => false,
|
||||||
|
@ -4162,6 +4170,7 @@ class ShareAPIControllerTest extends TestCase {
|
||||||
'file_target' => 'myTarget',
|
'file_target' => 'myTarget',
|
||||||
'share_with' => 'recipient',
|
'share_with' => 'recipient',
|
||||||
'share_with_displayname' => 'recipient',
|
'share_with_displayname' => 'recipient',
|
||||||
|
'share_with_displayname_unique' => 'recipient',
|
||||||
'mail_send' => 0,
|
'mail_send' => 0,
|
||||||
'mimetype' => 'mimeWithPreview',
|
'mimetype' => 'mimeWithPreview',
|
||||||
'has_preview' => true,
|
'has_preview' => true,
|
||||||
|
|
Loading…
Reference in New Issue