mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-28 19:25:36 +00:00
Allow convert guest to user via invite link (#7014)
This commit is contained in:
parent
afcc25beca
commit
c7fb3bdb98
@ -1786,6 +1786,9 @@ async function createPersonAccount (
|
|||||||
personAccountId
|
personAccountId
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
if (roleOrder[existingAccount.role] < roleOrder[role]) {
|
||||||
|
await ops.update(existingAccount, { role })
|
||||||
|
}
|
||||||
const person = await ops.findOne(contact.class.Person, { _id: existingAccount.person })
|
const person = await ops.findOne(contact.class.Person, { _id: existingAccount.person })
|
||||||
if (person === undefined) {
|
if (person === undefined) {
|
||||||
// Employee was deleted, let's restore it.
|
// Employee was deleted, let's restore it.
|
||||||
@ -1794,10 +1797,16 @@ async function createPersonAccount (
|
|||||||
await ops.updateDoc(contact.class.PersonAccount, existingAccount.space, existingAccount._id, {
|
await ops.updateDoc(contact.class.PersonAccount, existingAccount.space, existingAccount._id, {
|
||||||
person: employeeId
|
person: employeeId
|
||||||
})
|
})
|
||||||
} else if (ops.getHierarchy().hasMixin(person, contact.mixin.Employee)) {
|
} else if (shouldCreateEmployee) {
|
||||||
const employee = ops.getHierarchy().as(person, contact.mixin.Employee)
|
if (ops.getHierarchy().hasMixin(person, contact.mixin.Employee)) {
|
||||||
if (!employee.active) {
|
const employee = ops.getHierarchy().as(person, contact.mixin.Employee)
|
||||||
await ops.update(employee, {
|
if (!employee.active) {
|
||||||
|
await ops.update(employee, {
|
||||||
|
active: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await ops.createMixin(person._id, contact.class.Person, contact.space.Contacts, contact.mixin.Employee, {
|
||||||
active: true
|
active: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user