Fix calendar

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2025-06-06 13:04:49 +05:00
parent 8235380451
commit 601bda4947
No known key found for this signature in database
GPG Key ID: 211936D31001B31C
2 changed files with 3 additions and 15 deletions

View File

@ -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

View File

@ -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 {