diff --git a/models/tracker/src/index.ts b/models/tracker/src/index.ts index acdaea43098..e5a798cb114 100644 --- a/models/tracker/src/index.ts +++ b/models/tracker/src/index.ts @@ -17,7 +17,7 @@ import activity from '@hcengineering/activity' import chunter from '@hcengineering/chunter' import { type Builder } from '@hcengineering/model' import core from '@hcengineering/model-core' -import { type Ref, type Status } from '@hcengineering/core' +import { AccountRole, type Ref, type Status } from '@hcengineering/core' import { generateClassNotificationTypes } from '@hcengineering/model-notification' import presentation from '@hcengineering/model-presentation' import task from '@hcengineering/model-task' @@ -330,6 +330,7 @@ function defineApplication ( id: 'all-projects', component: workbench.component.SpecialView, icon: view.icon.List, + accessLevel: AccountRole.User, label: tracker.string.AllProjects, position: 'bottom', spaceClass: tracker.class.Project, diff --git a/plugins/contact-resources/src/components/CreateEmployee.svelte b/plugins/contact-resources/src/components/CreateEmployee.svelte index 3e757cd8533..37044bdb368 100644 --- a/plugins/contact-resources/src/components/CreateEmployee.svelte +++ b/plugins/contact-resources/src/components/CreateEmployee.svelte @@ -39,6 +39,8 @@ return firstName === '' && lastName === '' && email === '' } + let saving: boolean = false + const person: Data = { name: '', city: '', @@ -49,37 +51,49 @@ const client = getClient() async function createPerson () { - changeEmail() - const name = combineName(firstName, lastName) - person.name = name - person.avatar = await avatarEditor.createAvatar() - - await client.createDoc(contact.class.Person, contact.space.Contacts, person, id) - await client.createMixin(id, contact.class.Person, contact.space.Contacts, contact.mixin.Employee, { - active: true - }) - - const mail = email.trim() - - await client.createDoc(contact.class.PersonAccount, core.space.Model, { - email: mail, - person: id, - role: AccountRole.User - }) - - const sendInvite = await getResource(login.function.SendInvite) - await sendInvite(email.trim(), id, AccountRole.User) - - for (const channel of channels) { - await client.addCollection(contact.class.Channel, contact.space.Contacts, id, contact.class.Person, 'channels', { - value: channel.value, - provider: channel.provider + try { + saving = true + changeEmail() + const name = combineName(firstName, lastName) + person.name = name + person.avatar = await avatarEditor.createAvatar() + + await client.createDoc(contact.class.Person, contact.space.Contacts, person, id) + await client.createMixin(id, contact.class.Person, contact.space.Contacts, contact.mixin.Employee, { + active: true }) + + const mail = email.trim() + + await client.createDoc(contact.class.PersonAccount, core.space.Model, { + email: mail, + person: id, + role: AccountRole.User + }) + + const sendInvite = await getResource(login.function.SendInvite) + await sendInvite(email.trim(), id, AccountRole.User) + + for (const channel of channels) { + await client.addCollection( + contact.class.Channel, + contact.space.Contacts, + id, + contact.class.Person, + 'channels', + { + value: channel.value, + provider: channel.provider + } + ) + } + if (onCreate) { + await onCreate(id) + } + dispatch('close', id) + } finally { + saving = false } - if (onCreate) { - await onCreate(id) - } - dispatch('close') } let channels: AttachedData[] = [] @@ -128,7 +142,7 @@ on:changeContent > - {#if exists !== undefined} + {#if exists !== undefined && !saving}
diff --git a/plugins/contact-resources/src/components/CreateGuest.svelte b/plugins/contact-resources/src/components/CreateGuest.svelte index 815359d88bb..a56fbfe6923 100644 --- a/plugins/contact-resources/src/components/CreateGuest.svelte +++ b/plugins/contact-resources/src/components/CreateGuest.svelte @@ -36,40 +36,54 @@ return firstName === '' && lastName === '' && email === '' } + let saving: boolean = false + const dispatch = createEventDispatcher() const client = getClient() async function createPerson () { - changeEmail() - const name = combineName(firstName, lastName) - const person: Data = { - name, - city: '' - } - - await client.createDoc(contact.class.Person, contact.space.Contacts, person, id) - - const mail = email.trim() - - await client.createDoc(contact.class.PersonAccount, core.space.Model, { - email: mail, - person: id, - role: AccountRole.Guest - }) - - const sendInvite = await getResource(login.function.SendInvite) - await sendInvite(email.trim(), id, AccountRole.Guest) - - for (const channel of channels) { - await client.addCollection(contact.class.Channel, contact.space.Contacts, id, contact.class.Person, 'channels', { - value: channel.value, - provider: channel.provider + try { + saving = true + changeEmail() + const name = combineName(firstName, lastName) + const person: Data = { + name, + city: '' + } + + await client.createDoc(contact.class.Person, contact.space.Contacts, person, id) + + const mail = email.trim() + + await client.createDoc(contact.class.PersonAccount, core.space.Model, { + email: mail, + person: id, + role: AccountRole.Guest }) + + const sendInvite = await getResource(login.function.SendInvite) + await sendInvite(email.trim(), id, AccountRole.Guest) + + for (const channel of channels) { + await client.addCollection( + contact.class.Channel, + contact.space.Contacts, + id, + contact.class.Person, + 'channels', + { + value: channel.value, + provider: channel.provider + } + ) + } + if (onCreate) { + await onCreate(id) + } + dispatch('close', id) + } finally { + saving = false } - if (onCreate) { - await onCreate(id) - } - dispatch('close') } let channels: AttachedData[] = [] @@ -118,7 +132,7 @@ on:changeContent > - {#if exists !== undefined} + {#if exists !== undefined && !saving}
diff --git a/plugins/contact-resources/src/components/SpaceMembersEditor.svelte b/plugins/contact-resources/src/components/SpaceMembersEditor.svelte index 55317316932..c446d147978 100644 --- a/plugins/contact-resources/src/components/SpaceMembersEditor.svelte +++ b/plugins/contact-resources/src/components/SpaceMembersEditor.svelte @@ -13,7 +13,7 @@ // limitations under the License. -->