mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-15 12:55:59 +00:00
UBERF-4354 (#4066)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
63c24da02a
commit
79eb058d62
@ -545,11 +545,16 @@
|
|||||||
if (originDueDate !== event.dueDate) update.dueDate = event.dueDate
|
if (originDueDate !== event.dueDate) update.dueDate = event.dueDate
|
||||||
if (Object.keys(update).length > 0) {
|
if (Object.keys(update).length > 0) {
|
||||||
if (event._class === calendar.class.ReccuringInstance) {
|
if (event._class === calendar.class.ReccuringInstance) {
|
||||||
await updateReccuringInstance(update, {
|
const updated = await updateReccuringInstance(update, {
|
||||||
...event,
|
...event,
|
||||||
date: originDate,
|
date: originDate,
|
||||||
dueDate: originDueDate
|
dueDate: originDueDate
|
||||||
} as unknown as ReccuringInstance)
|
} as unknown as ReccuringInstance)
|
||||||
|
if (!updated) {
|
||||||
|
event.date = originDate
|
||||||
|
event.dueDate = originDueDate
|
||||||
|
events = events
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
await client.update(event, update)
|
await client.update(event, update)
|
||||||
}
|
}
|
||||||
|
@ -128,62 +128,76 @@ export async function updatePast (ops: DocumentUpdate<Event>, object: ReccuringI
|
|||||||
export async function updateReccuringInstance (
|
export async function updateReccuringInstance (
|
||||||
ops: DocumentUpdate<ReccuringEvent>,
|
ops: DocumentUpdate<ReccuringEvent>,
|
||||||
object: ReccuringInstance
|
object: ReccuringInstance
|
||||||
): Promise<void> {
|
): Promise<boolean> {
|
||||||
const client = getClient()
|
const client = getClient()
|
||||||
if (object.virtual !== true) {
|
if (object.virtual !== true) {
|
||||||
await client.update(object, ops)
|
await client.update(object, ops)
|
||||||
|
return true
|
||||||
} else {
|
} else {
|
||||||
showPopup(UpdateRecInstancePopup, { currentAvailable: ops.rules === undefined }, undefined, async (res) => {
|
return await new Promise((resolve) => {
|
||||||
if (res !== null) {
|
showPopup(UpdateRecInstancePopup, { currentAvailable: ops.rules === undefined }, undefined, async (res) => {
|
||||||
if (res.mode === 'current') {
|
if (res !== null) {
|
||||||
await client.addCollection(
|
try {
|
||||||
object._class,
|
if (res.mode === 'current') {
|
||||||
object.space,
|
await client.addCollection(
|
||||||
object.attachedTo,
|
object._class,
|
||||||
object.attachedToClass,
|
object.space,
|
||||||
object.collection,
|
object.attachedTo,
|
||||||
{
|
object.attachedToClass,
|
||||||
title: object.title,
|
object.collection,
|
||||||
description: object.description,
|
{
|
||||||
date: object.date,
|
title: object.title,
|
||||||
dueDate: object.dueDate,
|
description: object.description,
|
||||||
allDay: object.allDay,
|
date: object.date,
|
||||||
participants: object.participants,
|
dueDate: object.dueDate,
|
||||||
externalParticipants: object.externalParticipants,
|
allDay: object.allDay,
|
||||||
originalStartTime: object.originalStartTime,
|
participants: object.participants,
|
||||||
recurringEventId: object.recurringEventId,
|
externalParticipants: object.externalParticipants,
|
||||||
reminders: object.reminders,
|
originalStartTime: object.originalStartTime,
|
||||||
location: object.location,
|
recurringEventId: object.recurringEventId,
|
||||||
eventId: object.eventId,
|
reminders: object.reminders,
|
||||||
access: 'owner',
|
location: object.location,
|
||||||
rules: object.rules,
|
eventId: object.eventId,
|
||||||
exdate: object.exdate,
|
access: 'owner',
|
||||||
rdate: object.rdate,
|
rules: object.rules,
|
||||||
...ops
|
exdate: object.exdate,
|
||||||
},
|
rdate: object.rdate,
|
||||||
object._id
|
...ops
|
||||||
)
|
},
|
||||||
} else if (res.mode === 'all') {
|
object._id
|
||||||
const base = await client.findOne(calendar.class.ReccuringEvent, {
|
)
|
||||||
space: object.space,
|
resolve(true)
|
||||||
eventId: object.recurringEventId
|
} else if (res.mode === 'all') {
|
||||||
})
|
const base = await client.findOne(calendar.class.ReccuringEvent, {
|
||||||
if (base !== undefined) {
|
space: object.space,
|
||||||
if (ops.date !== undefined) {
|
eventId: object.recurringEventId
|
||||||
const diff = object.date - ops.date
|
})
|
||||||
ops.date = base.date - diff
|
if (base !== undefined) {
|
||||||
|
if (ops.date !== undefined) {
|
||||||
|
const diff = object.date - ops.date
|
||||||
|
ops.date = base.date - diff
|
||||||
|
}
|
||||||
|
if (ops.dueDate !== undefined) {
|
||||||
|
const diff = object.dueDate - ops.dueDate
|
||||||
|
ops.dueDate = base.dueDate - diff
|
||||||
|
}
|
||||||
|
await client.update(base, ops)
|
||||||
|
resolve(true)
|
||||||
|
}
|
||||||
|
resolve(false)
|
||||||
|
} else if (res.mode === 'next') {
|
||||||
|
await updatePast(ops, object)
|
||||||
|
resolve(true)
|
||||||
}
|
}
|
||||||
if (ops.dueDate !== undefined) {
|
resolve(false)
|
||||||
const diff = object.dueDate - ops.dueDate
|
} catch {
|
||||||
ops.dueDate = base.dueDate - diff
|
resolve(false)
|
||||||
}
|
|
||||||
await client.update(base, ops)
|
|
||||||
}
|
}
|
||||||
} else if (res.mode === 'next') {
|
} else {
|
||||||
await updatePast(ops, object)
|
resolve(false)
|
||||||
}
|
}
|
||||||
}
|
closePopup()
|
||||||
closePopup()
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user