diff --git a/src/modules/modals/EditContext.vue b/src/modules/modals/EditContext.vue index 5690ca21f..b3307b5bf 100644 --- a/src/modules/modals/EditContext.vue +++ b/src/modules/modals/EditContext.vue @@ -186,7 +186,7 @@ export default { }, getContextReceivers(context) { let sharing = Object.values(context.sharing) - sharing = sharing.filter((share) => getCurrentUser().uid !== share.receiver) + sharing = sharing.filter((share) => !(getCurrentUser().uid === share.receiver && share.receiver_type === 'user')) const receivers = sharing.map((share) => { return { id: share.receiver, diff --git a/src/shared/components/ncContextResource/NcContextResource.vue b/src/shared/components/ncContextResource/NcContextResource.vue index 9baa6810d..469dcf886 100644 --- a/src/shared/components/ncContextResource/NcContextResource.vue +++ b/src/shared/components/ncContextResource/NcContextResource.vue @@ -7,7 +7,7 @@
- +
diff --git a/src/shared/components/ncContextResource/ResourceSharees.vue b/src/shared/components/ncContextResource/ResourceSharees.vue index c8e5910d4..80b5b1a64 100644 --- a/src/shared/components/ncContextResource/ResourceSharees.vue +++ b/src/shared/components/ncContextResource/ResourceSharees.vue @@ -54,7 +54,13 @@ export default { data() { return { preExistingSharees: [...this.receivers], - localSharees: this.receivers.map(userObject => userObject.id), + localSharees: this.receivers.map(obj => ({ + id: obj.id, + displayName: obj.displayName, + icon: obj.icon, + isUser: obj.isUser, + key: obj.key, + })), } }, @@ -64,7 +70,13 @@ export default { return this.localSharees }, set(v) { - this.localSharees = v.map(userObject => userObject.id) + this.localSharees = v.map(obj => ({ + id: obj.id, + displayName: obj.displayName, + icon: obj.icon, + isUser: obj.isUser, + key: obj.key, + })) this.$emit('update', v) }, }, @@ -77,10 +89,15 @@ export default { filterOutUnwantedItems(items) { // Filter out existing items - items = items.filter((item) => !(item.isUser && this.localSharees.includes(item.id))) - + const filteredItems = [] + items.forEach((item) => { + const alreadyExists = this.localSharees.find((localItem) => item.id === localItem.id && item.isUser === localItem.isUser) + if (!alreadyExists) { + filteredItems.push(item) + } + }) // Filter out current user - return items.filter((item) => !(item.isUser && item.id === this.currentUserId)) + return filteredItems.filter((item) => !(item.isUser && item.id === this.currentUserId)) }, formatResult(autocompleteResult) {