diff --git a/packages/presentation/src/components/AssigneeBox.svelte b/packages/presentation/src/components/AssigneeBox.svelte index a42f2aaf9b..eb6eec9f16 100644 --- a/packages/presentation/src/components/AssigneeBox.svelte +++ b/packages/presentation/src/components/AssigneeBox.svelte @@ -48,6 +48,7 @@ export let prevAssigned: Ref[] | undefined = [] export let projectLead: Ref | undefined = undefined export let projectMembers: Ref[] | undefined = [] + export let allowDeselect = true export let titleDeselect: IntlString | undefined = undefined export let readonly = false export let kind: ButtonKind = 'no-border' @@ -95,6 +96,7 @@ icon, selected: value, placeholder, + allowDeselect, titleDeselect }, !$$slots.content ? container : getEventPositionElement(ev), diff --git a/packages/presentation/src/components/AssigneePopup.svelte b/packages/presentation/src/components/AssigneePopup.svelte index aa5b0303d3..3fe965e61a 100644 --- a/packages/presentation/src/components/AssigneePopup.svelte +++ b/packages/presentation/src/components/AssigneePopup.svelte @@ -44,6 +44,7 @@ export let prevAssigned: Ref[] | undefined = [] export let projectLead: Ref | undefined = undefined export let projectMembers: Ref[] | undefined = [] + export let allowDeselect = true export let titleDeselect: IntlString | undefined export let placeholder: IntlString = presentation.string.Search export let ignoreUsers: Ref[] = [] @@ -72,7 +73,10 @@ { ...(docQuery ?? {}), [searchField]: { $like: '%' + search + '%' }, - _id: { $nin: ignoreUsers } + _id: { + ...(typeof docQuery?._id === 'object' ? docQuery._id : {}), + $nin: ignoreUsers + } }, (result) => { objects = result @@ -117,7 +121,7 @@ async function handleSelection (evt: Event | undefined, selection: number): Promise { const person = contacts[selection] - selected = person._id === selected ? undefined : person._id + selected = allowDeselect && person._id === selected ? undefined : person._id dispatch('close', selected !== undefined ? person : undefined) } @@ -232,7 +236,7 @@ handleSelection(undefined, item) }} > - {#if selected} + {#if allowDeselect && selected}
{#if obj._id === selected}