Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(files_sharing): Modularize SharingInput to adapt with share se…
…ctions

Signed-off-by: nfebe <[email protected]>
  • Loading branch information
nfebe committed Jan 23, 2025
commit 33eaf9ca4d6a9c61a37e3c78d5ecc6e7a517b7f1
48 changes: 34 additions & 14 deletions apps/files_sharing/src/components/SharingInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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>
Expand Down Expand Up @@ -73,6 +74,14 @@ export default {
type: Boolean,
required: true,
},
isExternal: {
type: Boolean,
default: false,
},
placeholder: {
type: String,
default: '',
},
},

data() {
Expand Down Expand Up @@ -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 …')
Expand Down Expand Up @@ -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,
]

if (getCapabilities().files_sharing.public.enabled === true) {
let shareType = []

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)
}

Expand Down