feat(shares): filter out users or teams a list is already shared with
This commit is contained in:
parent
fab58a2e6d
commit
05ded65f8b
1 changed files with 26 additions and 15 deletions
|
@ -120,7 +120,9 @@
|
|||
v-if="showDeleteModal"
|
||||
>
|
||||
<template #header>
|
||||
<span>{{ $t('list.share.userTeam.removeHeader', {type: shareTypeName, sharable: sharableName}) }}</span>
|
||||
<span>{{
|
||||
$t('list.share.userTeam.removeHeader', {type: shareTypeName, sharable: sharableName})
|
||||
}}</span>
|
||||
</template>
|
||||
<template #text>
|
||||
<p>{{ $t('list.share.userTeam.removeText', {type: shareTypeName, sharable: sharableName}) }}</p>
|
||||
|
@ -132,6 +134,7 @@
|
|||
|
||||
<script lang="ts">
|
||||
import {defineComponent} from 'vue'
|
||||
|
||||
export default defineComponent({name: 'userTeamShare'})
|
||||
</script>
|
||||
|
||||
|
@ -290,10 +293,12 @@ async function deleteSharable() {
|
|||
sharables.value.splice(i, 1)
|
||||
}
|
||||
}
|
||||
success({message: t('list.share.userTeam.removeSuccess', {
|
||||
success({
|
||||
message: t('list.share.userTeam.removeSuccess', {
|
||||
type: shareTypeName.value,
|
||||
sharable: sharableName.value,
|
||||
})})
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
async function add(admin) {
|
||||
|
@ -348,16 +353,22 @@ async function toggleType(sharable) {
|
|||
}
|
||||
|
||||
const found = ref([])
|
||||
|
||||
const currentUserId = computed(() => store.state.auth.info.id)
|
||||
async function find(query) {
|
||||
if (query === '') {
|
||||
clearAll()
|
||||
found.value = []
|
||||
return
|
||||
}
|
||||
found.value = await searchService.getAll({}, {s: query})
|
||||
const results = await searchService.getAll({}, {s: query})
|
||||
found.value = results
|
||||
.filter(m => {
|
||||
if(props.shareType === 'user' && m.id === currentUserId.value) {
|
||||
return false
|
||||
}
|
||||
|
||||
function clearAll() {
|
||||
found.value = []
|
||||
return typeof sharables.value.find(s => s.id === m.id) === 'undefined'
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in a new issue