feat(files_sharing): Modularize SharingInput to adapt with share sections

Signed-off-by: nfebe <fenn25.fn@gmail.com>
This commit is contained in:
nfebe 2025-01-22 00:03:04 +01:00
parent 24d7fc1bdd
commit 64138650d1

View file

@ -5,6 +5,7 @@
<template>
<div class="sharing-search">
<label for="sharing-search-input">{{ t('files_sharing', 'Search for share recipients') }}</label>
<NcSelect ref="select"
v-model="value"
input-id="sharing-search-input"
@ -20,7 +21,7 @@
@search="asyncFind"
@option:selected="onSelected">
<template #no-options="{ search }">
{{ search ? noResultText : t('files_sharing', 'Add users and teams') }}
{{ search ? noResultText : placeholder }}
</template>
</NcSelect>
</div>
@ -73,6 +74,14 @@ export default {
type: Boolean,
required: true,
},
isExternal: {
type: Boolean,
default: false,
},
placeholder: {
type: String,
default: '',
},
},
data() {
@ -105,6 +114,10 @@ export default {
if (!this.canReshare) {
return t('files_sharing', 'Resharing is not allowed')
}
if (this.placeholder) {
return this.placeholder
}
// We can always search with email addresses for users too
if (!allowRemoteSharing) {
return t('files_sharing', 'Name or email …')
@ -167,19 +180,26 @@ export default {
lookup = true
}
const shareType = [
ShareType.User,
ShareType.Group,
ShareType.Remote,
ShareType.RemoteGroup,
ShareType.Team,
ShareType.Room,
ShareType.Guest,
ShareType.Deck,
ShareType.ScienceMesh,
]
let shareType = []
if (getCapabilities().files_sharing.public.enabled === true) {
if (this.isExternal) {
shareType.push(ShareType.Remote)
shareType.push(ShareType.RemoteGroup)
} else {
// Merge shareType array
shareType = shareType.concat([
ShareType.User,
ShareType.Group,
ShareType.Team,
ShareType.Room,
ShareType.Guest,
ShareType.Deck,
ShareType.ScienceMesh,
])
}
if (getCapabilities().files_sharing.public.enabled === true && this.isExternal) {
shareType.push(ShareType.Email)
}