mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-27 10:49:44 +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 (Object.keys(update).length > 0) {
|
||||
if (event._class === calendar.class.ReccuringInstance) {
|
||||
await updateReccuringInstance(update, {
|
||||
const updated = await updateReccuringInstance(update, {
|
||||
...event,
|
||||
date: originDate,
|
||||
dueDate: originDueDate
|
||||
} as unknown as ReccuringInstance)
|
||||
if (!updated) {
|
||||
event.date = originDate
|
||||
event.dueDate = originDueDate
|
||||
events = events
|
||||
}
|
||||
} else {
|
||||
await client.update(event, update)
|
||||
}
|
||||
|
@ -128,13 +128,16 @@ export async function updatePast (ops: DocumentUpdate<Event>, object: ReccuringI
|
||||
export async function updateReccuringInstance (
|
||||
ops: DocumentUpdate<ReccuringEvent>,
|
||||
object: ReccuringInstance
|
||||
): Promise<void> {
|
||||
): Promise<boolean> {
|
||||
const client = getClient()
|
||||
if (object.virtual !== true) {
|
||||
await client.update(object, ops)
|
||||
return true
|
||||
} else {
|
||||
return await new Promise((resolve) => {
|
||||
showPopup(UpdateRecInstancePopup, { currentAvailable: ops.rules === undefined }, undefined, async (res) => {
|
||||
if (res !== null) {
|
||||
try {
|
||||
if (res.mode === 'current') {
|
||||
await client.addCollection(
|
||||
object._class,
|
||||
@ -163,6 +166,7 @@ export async function updateReccuringInstance (
|
||||
},
|
||||
object._id
|
||||
)
|
||||
resolve(true)
|
||||
} else if (res.mode === 'all') {
|
||||
const base = await client.findOne(calendar.class.ReccuringEvent, {
|
||||
space: object.space,
|
||||
@ -178,12 +182,22 @@ export async function updateReccuringInstance (
|
||||
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)
|
||||
}
|
||||
resolve(false)
|
||||
} catch {
|
||||
resolve(false)
|
||||
}
|
||||
} else {
|
||||
resolve(false)
|
||||
}
|
||||
closePopup()
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user