From 55a67bbc0cdb136b6b3785523d279cf858de9c11 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 19 May 2025 19:05:37 +0530 Subject: [PATCH] fix: do not show contacts in dropdown in invite member page --- crm/api/__init__.py | 6 +++++ .../Controls/MultiSelectEmailInput.vue | 25 +++++++++++++++++-- .../components/Settings/InviteMemberPage.vue | 14 ++++++++--- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/crm/api/__init__.py b/crm/api/__init__.py index cb56e3bd..cc2fda67 100644 --- a/crm/api/__init__.py +++ b/crm/api/__init__.py @@ -123,6 +123,12 @@ def invite_by_email(emails: str, role: str): for email in to_invite: frappe.get_doc(doctype="CRM Invitation", email=email, role=role).insert(ignore_permissions=True) + return { + "existing_members": existing_members, + "existing_invites": existing_invites, + "to_invite": to_invite, + } + @frappe.whitelist() def get_file_uploader_defaults(doctype: str): diff --git a/frontend/src/components/Controls/MultiSelectEmailInput.vue b/frontend/src/components/Controls/MultiSelectEmailInput.vue index bf1d734b..b5ba3f84 100644 --- a/frontend/src/components/Controls/MultiSelectEmailInput.vue +++ b/frontend/src/components/Controls/MultiSelectEmailInput.vue @@ -58,6 +58,21 @@ class="p-1.5 max-h-[12rem] overflow-y-auto" static > +
+ + {{ + fetchContacts + ? __('No results found') + : __('Type an email address to add') + }} +
`${value} is an Invalid value`, }, + fetchContacts: { + type: Boolean, + default: true, + }, }) const values = defineModel() @@ -191,17 +210,19 @@ const filterOptions = createResource({ }) const options = computed(() => { - let searchedContacts = filterOptions.data || [] + let searchedContacts = props.fetchContacts ? filterOptions.data : [] if (!searchedContacts.length && query.value) { searchedContacts.push({ label: query.value, value: query.value, }) } - return searchedContacts + return searchedContacts || [] }) function reload(val) { + if (!props.fetchContacts) return + filterOptions.update({ params: { txt: val }, }) diff --git a/frontend/src/components/Settings/InviteMemberPage.vue b/frontend/src/components/Settings/InviteMemberPage.vue index e81a1630..3f0cac8d 100644 --- a/frontend/src/components/Settings/InviteMemberPage.vue +++ b/frontend/src/components/Settings/InviteMemberPage.vue @@ -20,6 +20,7 @@ :error-message=" (value) => __('{0} is an invalid email address', [value]) " + :fetchContacts="false" />