Files
Davide Silvestri 23f328cb19 feat(database): assign identities to rows and mention them in comments (#6619)
* feat(database): assign and mention identities behind a field option

- Collaborator fields get `include_identities` and long text fields
  `long_text_include_identities`, both off by default.
- With the option on, active identities of the workspace can be assigned
  or suggested as mentions; they are shown with their icon and renamed
  in realtime, and they never receive notifications.
- Turning the collaborator option off backs up the column, deletes the
  identity assignments and strips identities from the view defaults, so
  the update can be undone.
- Identities can author row comments and be mentioned in them.
- Exports write an identity as `Name <identity>`.

* refactor: hide internal emails in collaborator exports through one check

* fix: import a personal view only for a person, without a query per owner

* fix: show collaborator identities with the icon of the user subject type

* refactor: drop a redundant local import of the core handler

* fix: unify identity icons and space field options

* fix: keep identity field menus and saved mentions readable

* fix: limit identity mention suggestions to row comments

* perf: prefetch available collaborators once per workspace

* fix: use workspace members as authors of generated rows

* fix: resolve linked collaborator values by member email

* fix: use workspace collaborators for field pickers and paste

* refactor: move identity avatar styles to the avatar stylesheet

* fix: address review feedback on identity collaborators
2026-11-18 22:53:44 +01:00

146 lines
3.8 KiB
Vue

<template>
<div
class="dropdown"
:class="{
'dropdown--floating': !showInput,
'dropdown--disabled': disabled,
'dropdown--large': size === 'large',
'dropdown--error': error,
}"
:tabindex="realTabindex"
@contextmenu.stop
@focusin="show()"
@focusout="focusout($event)"
>
<a
v-if="showInput"
class="select-options__dropdown-selected dropdown__selected"
@click="show()"
>
<div v-if="initialDisplayName">
{{ initialDisplayName }}
</div>
<div v-else-if="hasValue()">
{{ selectedName }}
</div>
<i
v-if="!disabled"
class="dropdown__toggle-icon iconoir-nav-arrow-down"
></i>
</a>
<div
ref="itemsContainer"
class="dropdown__items"
:class="{
hidden: !open,
'dropdown__items--fixed': fixedItemsImmutable,
}"
>
<div v-if="showSearch" class="select__search">
<i class="select__search-icon iconoir-search"></i>
<input
ref="search"
v-model="query"
type="text"
class="select__search-input"
:placeholder="searchText"
tabindex="0"
@keyup="search"
/>
</div>
<ul
ref="items"
v-prevent-parent-scroll
v-auto-overflow-scroll
class="select__items"
:class="{ 'select__items--no-max-height': fixedItemsImmutable }"
tabindex="-1"
@scroll="scroll"
>
<FieldCollaboratorDropdownItem
v-if="showEmptyValue"
:name="''"
:value="null"
:color="''"
></FieldCollaboratorDropdownItem>
<FieldCollaboratorDropdownItem
v-for="collaborator in people"
:key="collaborator.id"
:name="collaborator.name"
:value="collaborator.id"
></FieldCollaboratorDropdownItem>
<li v-if="identities.length" class="select-collaborators__group">
{{ $t('fieldmultipleCollaboratorsDropdown.identities') }}
</li>
<FieldCollaboratorDropdownItem
v-for="collaborator in identities"
:key="collaborator.id"
:name="collaborator.name"
:value="collaborator.id"
user-type="identity"
></FieldCollaboratorDropdownItem>
</ul>
<div v-if="isNotFound" class="select__description">
{{ $t('fieldmultipleCollaboratorsDropdown.notFound') }}
</div>
</div>
</div>
</template>
<script>
import inMemoryPaginatedDropdown from '@baserow/modules/core/mixins/inMemoryPaginatedDropdown'
import FieldCollaboratorDropdownItem from '@baserow/modules/database/components/field/FieldCollaboratorDropdownItem'
export default {
name: 'FieldCollaboratorDropdown',
components: { FieldCollaboratorDropdownItem },
mixins: [inMemoryPaginatedDropdown],
props: {
collaborators: {
type: Array,
required: true,
},
showEmptyValue: {
type: Boolean,
required: false,
default: true,
},
pageSize: {
type: Number,
required: false,
default: 100, // override default pageSize of 20
},
},
computed: {
people() {
return this.results.filter(
(collaborator) => !this.isIdentity(collaborator)
)
},
identities() {
return this.results.filter((collaborator) =>
this.isIdentity(collaborator)
)
},
isNotFound() {
return this.results.length === 0 && this.query !== ''
},
},
watch: {
collaborators() {
this.fetch(1, this.query)
},
},
methods: {
isIdentity(collaborator) {
return collaborator.user_type === 'identity'
},
filterItems(search) {
return this.collaborators.filter((collaborator) => {
return collaborator.name.toLowerCase().includes(search.toLowerCase())
})
},
},
}
</script>