mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 03:14:40 +03:00
parent
2d92b9aa46
commit
9c22b1732f
@ -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,
|
||||
|
@ -39,6 +39,8 @@
|
||||
return firstName === '' && lastName === '' && email === ''
|
||||
}
|
||||
|
||||
let saving: boolean = false
|
||||
|
||||
const person: Data<Employee> = {
|
||||
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()
|
||||
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
|
||||
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<Channel>[] = []
|
||||
@ -128,7 +142,7 @@
|
||||
on:changeContent
|
||||
>
|
||||
<svelte:fragment slot="error">
|
||||
{#if exists !== undefined}
|
||||
{#if exists !== undefined && !saving}
|
||||
<div class="flex-row-center error-color">
|
||||
<IconInfo size={'small'} />
|
||||
<span class="text-sm overflow-label ml-2">
|
||||
|
@ -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<Person> = {
|
||||
name,
|
||||
city: ''
|
||||
}
|
||||
try {
|
||||
saving = true
|
||||
changeEmail()
|
||||
const name = combineName(firstName, lastName)
|
||||
const person: Data<Person> = {
|
||||
name,
|
||||
city: ''
|
||||
}
|
||||
|
||||
await client.createDoc(contact.class.Person, contact.space.Contacts, person, id)
|
||||
await client.createDoc(contact.class.Person, contact.space.Contacts, person, id)
|
||||
|
||||
const mail = email.trim()
|
||||
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
|
||||
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<Channel>[] = []
|
||||
@ -118,7 +132,7 @@
|
||||
on:changeContent
|
||||
>
|
||||
<svelte:fragment slot="error">
|
||||
{#if exists !== undefined}
|
||||
{#if exists !== undefined && !saving}
|
||||
<div class="flex-row-center error-color">
|
||||
<IconInfo size={'small'} />
|
||||
<span class="text-sm overflow-label ml-2">
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Account, Ref, getCurrentAccount } from '@hcengineering/core'
|
||||
import { Account, AccountRole, Ref, getCurrentAccount, hasAccountRole } from '@hcengineering/core'
|
||||
import { IntlString } from '@hcengineering/platform'
|
||||
import { Button, ButtonKind, ButtonSize } from '@hcengineering/ui'
|
||||
import view from '@hcengineering/view'
|
||||
@ -41,5 +41,14 @@
|
||||
{#if !joined && onChange !== undefined}
|
||||
<Button label={view.string.Join} {size} {width} kind={'primary'} on:click={join} />
|
||||
{:else}
|
||||
<AccountArrayEditor {label} {value} {onChange} {readonly} {kind} {size} {width} allowGuests />
|
||||
<AccountArrayEditor
|
||||
{label}
|
||||
{value}
|
||||
{onChange}
|
||||
readonly={readonly || !hasAccountRole(getCurrentAccount(), AccountRole.User)}
|
||||
{kind}
|
||||
{size}
|
||||
{width}
|
||||
allowGuests
|
||||
/>
|
||||
{/if}
|
||||
|
@ -375,6 +375,7 @@
|
||||
</div>
|
||||
<AccountArrayEditor
|
||||
value={members}
|
||||
allowGuests
|
||||
label={documentRes.string.TeamspaceMembers}
|
||||
onChange={handleMembersChanged}
|
||||
kind={'regular'}
|
||||
|
@ -164,7 +164,7 @@
|
||||
</script>
|
||||
|
||||
<SpaceCreateCard
|
||||
label={funnel ? view.string.EdifFunnel : leadRes.string.CreateFunnel}
|
||||
label={funnel ? leadRes.string.EditFunnel : leadRes.string.CreateFunnel}
|
||||
okAction={save}
|
||||
okLabel={!isNew ? ui.string.Save : undefined}
|
||||
{canSave}
|
||||
@ -212,6 +212,7 @@
|
||||
</div>
|
||||
<AccountArrayEditor
|
||||
value={members}
|
||||
allowGuests
|
||||
label={leadRes.string.Members}
|
||||
onChange={handleMembersChanged}
|
||||
kind={'regular'}
|
||||
|
@ -471,6 +471,7 @@
|
||||
<AccountArrayEditor
|
||||
value={owners}
|
||||
label={core.string.Owners}
|
||||
allowGuests
|
||||
onChange={handleOwnersChanged}
|
||||
kind={'regular'}
|
||||
size={'large'}
|
||||
|
@ -1895,7 +1895,7 @@ export async function sendInvite (
|
||||
const inviteId = await getInviteLink(ctx, db, productId, token, exp, email, 1)
|
||||
const link = concatLink(front, `/login/join?inviteId=${inviteId.toString()}`)
|
||||
|
||||
const ws = workspace.workspace
|
||||
const ws = workspace.workspaceName ?? workspace.workspace
|
||||
const text = await translate(accountPlugin.string.InviteText, { link, ws, expHours })
|
||||
const html = await translate(accountPlugin.string.InviteHTML, { link, ws, expHours })
|
||||
const subject = await translate(accountPlugin.string.InviteSubject, { ws })
|
||||
|
Loading…
Reference in New Issue
Block a user