1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-21 23:37:55 +00:00
bramw_baserow/web-frontend/modules/database/mixins/availableCollaborators.js
2023-07-17 19:13:04 +00:00

24 lines
809 B
JavaScript

export default {
computed: {
workspaceCollaborators() {
const workspace = this.$store.getters['workspace/getSelected']
return workspace.users.filter((user) => user.to_be_deleted === false)
},
availableCollaborators() {
// When converting from a CollaboratorField to another field it can happen
// that this property is being computed with the value (this.value) of the
// converted to field type. It can either be null, or not an array. In both cases
// we can safely return an empty array.
if (!Array.isArray(this.value)) {
return []
}
const ids = new Set(this.value.map((item) => item.id))
const result = this.workspaceCollaborators.filter(
(item) => !ids.has(item.user_id)
)
return result
},
},
}