mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-31 12:49:57 +00: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
|
to: Timestamp
|
||||||
): ReccuringInstance[] {
|
): ReccuringInstance[] {
|
||||||
let res: ReccuringInstance[] = []
|
let res: ReccuringInstance[] = []
|
||||||
for (const rule of event.rules) {
|
for (const rule of event.rules ?? []) {
|
||||||
const values = generateRecurringValues(rule, event.date, from, to)
|
const values = generateRecurringValues(rule, event.date, from, to)
|
||||||
for (const val of values) {
|
for (const val of values) {
|
||||||
const instance = getInstance(event, val)
|
const instance = getInstance(event, val)
|
||||||
res.push(instance)
|
res.push(instance)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const date of event.rdate) {
|
for (const date of event.rdate ?? []) {
|
||||||
if (date < from || date > to) continue
|
if (date < from || date > to) continue
|
||||||
const instance = getInstance(event, date)
|
const instance = getInstance(event, date)
|
||||||
const exists = res.find((p) => p.date === instance.date)
|
const exists = res.find((p) => p.date === instance.date)
|
||||||
if (exists === undefined) res.push(instance)
|
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((p) => !excludes.has(p.date))
|
||||||
res = res.filter((i) => {
|
res = res.filter((i) => {
|
||||||
const override = instances.find((p) => p.originalStartTime === i.date)
|
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)
|
(p) => (p._id !== ev.createdBy ?? ev.modifiedBy) && ev.participants.includes(p.person)
|
||||||
)
|
)
|
||||||
for (const acc of participants) {
|
for (const acc of participants) {
|
||||||
const innerTx = control.txFactory.createTxCreateDoc(ev._class, `${acc._id}_calendar` as Ref<Calendar>, {
|
const { _id, _class, space, modifiedBy, modifiedOn, ...data } = ev
|
||||||
eventId: ev.eventId,
|
const innerTx = control.txFactory.createTxCreateDoc(_class, `${acc._id}_calendar` as Ref<Calendar>, {
|
||||||
participants: ev.participants,
|
...data,
|
||||||
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,
|
|
||||||
access: 'reader'
|
access: 'reader'
|
||||||
})
|
})
|
||||||
res.push(
|
res.push(
|
||||||
|
Loading…
Reference in New Issue
Block a user