diff options
Diffstat (limited to 'src/components/Albums/CollaboratorsSelectionForm.vue')
-rw-r--r-- | src/components/Albums/CollaboratorsSelectionForm.vue | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/components/Albums/CollaboratorsSelectionForm.vue b/src/components/Albums/CollaboratorsSelectionForm.vue index 5651808b..fc237e3e 100644 --- a/src/components/Albums/CollaboratorsSelectionForm.vue +++ b/src/components/Albums/CollaboratorsSelectionForm.vue @@ -192,7 +192,7 @@ export default { searchResults() { return this.currentSearchResults .filter(({ id }) => id !== getCurrentUser().uid) - .map(({ source, id }) => `${source}:${id}`) + .map(({ type, id }) => `${type}:${id}`) .filter(key => !this.selectedCollaboratorsKeys.includes(key)) .map((key) => ({ key, height: 48 })) }, @@ -207,11 +207,11 @@ export default { mounted() { this.searchCollaborators() - this.selectedCollaboratorsKeys = this.collaborators.map(({ source, id }) => `${source}:${id}`) + this.selectedCollaboratorsKeys = this.collaborators.map(({ type, id }) => `${type}:${id}`) this.availableCollaborators = { ...this.availableCollaborators, ...this.collaborators - .reduce((collaborators, collaborator) => ({ ...collaborators, [`${collaborator.source}:${collaborator.id}`]: collaborator }), {}), + .reduce((collaborators, collaborator) => ({ ...collaborators, [`${collaborator.type}:${collaborator.id}`]: collaborator }), {}), } }, @@ -238,10 +238,23 @@ export default { }) this.currentSearchResults = response.data.ocs.data + .map(collaborator => { + let type = -1 + switch (collaborator.source) { + case 'users': + type = OC.Share.SHARE_TYPE_USER + break + case 'groups': + type = OC.Share.SHARE_TYPE_GROUP + break + } + + return { ...collaborator, type } + }) this.availableCollaborators = { ...this.availableCollaborators, - ...response.data.ocs.data - .reduce((collaborators, collaborator) => ({ ...collaborators, [`${collaborator.source}:${collaborator.id}`]: collaborator }), {}), + ...this.currentSearchResults + .reduce((collaborators, collaborator) => ({ ...collaborators, [`${collaborator.type}:${collaborator.id}`]: collaborator }), {}), } } catch (error) { this.errorFetchingCollaborators = error |