mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-09 09:20:54 +00:00
Fix calendar
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
8235380451
commit
601bda4947
@ -101,7 +101,7 @@ export async function OnPersonAccountCreate (txes: Tx[], control: TriggerControl
|
||||
{
|
||||
name: user.email,
|
||||
hidden: false,
|
||||
visibility: 'public'
|
||||
visibility: 'freeBusy'
|
||||
},
|
||||
`${user._id}_calendar` as Ref<Calendar>,
|
||||
undefined,
|
||||
@ -313,7 +313,7 @@ async function onEventCreate (ctx: TxCreateDoc<Event>, control: TriggerControl):
|
||||
for (const part of event.participants) {
|
||||
const acc = accounts.find((a) => a.person === part)
|
||||
if (acc === undefined) continue
|
||||
if (acc._id === (event.createdBy ?? event.modifiedBy)) continue
|
||||
if (acc._id === event.user) continue
|
||||
const user = acc._id
|
||||
const calendar = getCalendar(calendars, acc._id, event.calendar)
|
||||
if (calendar === undefined) continue
|
||||
|
@ -306,19 +306,7 @@ export class CalendarClient {
|
||||
hidden: false,
|
||||
externalId: val.id,
|
||||
externalUser: me,
|
||||
default: false
|
||||
}
|
||||
if (val.primary === true) {
|
||||
const primaryExists = await this.client.findOne(
|
||||
calendar.class.ExternalCalendar,
|
||||
{
|
||||
createdBy: this.user.userId
|
||||
},
|
||||
{ projection: { _id: 1 } }
|
||||
)
|
||||
if (primaryExists === undefined) {
|
||||
data.default = true
|
||||
}
|
||||
default: val.primary ?? false
|
||||
}
|
||||
await this.client.createDoc<ExternalCalendar>(calendar.class.ExternalCalendar, calendar.space.Calendar, data)
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user