mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 11:42:30 +03:00
calendar_hot_fixes (#3571)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
07cc690d23
commit
58dfa9d4a7
@ -227,21 +227,21 @@ function getReccuringEventInstances (
|
||||
to: Timestamp
|
||||
): ReccuringInstance[] {
|
||||
let res: ReccuringInstance[] = []
|
||||
for (const rule of event.rules) {
|
||||
for (const rule of event.rules ?? []) {
|
||||
const values = generateRecurringValues(rule, event.date, from, to)
|
||||
for (const val of values) {
|
||||
const instance = getInstance(event, val)
|
||||
res.push(instance)
|
||||
}
|
||||
}
|
||||
for (const date of event.rdate) {
|
||||
for (const date of event.rdate ?? []) {
|
||||
if (date < from || date > to) continue
|
||||
const instance = getInstance(event, date)
|
||||
const exists = res.find((p) => p.date === instance.date)
|
||||
if (exists === undefined) res.push(instance)
|
||||
}
|
||||
|
||||
const excludes = new Set(event.exdate)
|
||||
const excludes = new Set(event.exdate ?? [])
|
||||
res = res.filter((p) => !excludes.has(p.date))
|
||||
res = res.filter((i) => {
|
||||
const override = instances.find((p) => p.originalStartTime === i.date)
|
||||
|
@ -113,20 +113,9 @@ async function onEventCreate (tx: Tx, control: TriggerControl): Promise<Tx[]> {
|
||||
(p) => (p._id !== ev.createdBy ?? ev.modifiedBy) && ev.participants.includes(p.person)
|
||||
)
|
||||
for (const acc of participants) {
|
||||
const innerTx = control.txFactory.createTxCreateDoc(ev._class, `${acc._id}_calendar` as Ref<Calendar>, {
|
||||
eventId: ev.eventId,
|
||||
participants: ev.participants,
|
||||
externalParticipants: ev.externalParticipants,
|
||||
title: ev.title,
|
||||
description: ev.description,
|
||||
allDay: ev.allDay,
|
||||
attachedTo: ev.attachedTo,
|
||||
attachedToClass: ev.attachedToClass,
|
||||
collection: ev.collection,
|
||||
date: ev.date,
|
||||
dueDate: ev.dueDate,
|
||||
reminders: ev.reminders,
|
||||
location: ev.location,
|
||||
const { _id, _class, space, modifiedBy, modifiedOn, ...data } = ev
|
||||
const innerTx = control.txFactory.createTxCreateDoc(_class, `${acc._id}_calendar` as Ref<Calendar>, {
|
||||
...data,
|
||||
access: 'reader'
|
||||
})
|
||||
res.push(
|
||||
|
Loading…
Reference in New Issue
Block a user