fix(03): CR-01 preserve RRULE on edit-as-move (forward source rule to create row)
This commit is contained in:
@@ -282,6 +282,23 @@ async function dispatchRow(row: OutboxRow): Promise<DispatchResult> {
|
||||
} catch {
|
||||
return { success: false, conflict: false, hardFail: true, transient: false, error: 'payload parse failed' }
|
||||
}
|
||||
// CR-01: edit-as-move RRULE preservation. The same-calendar `update` branch
|
||||
// preserves a recurring series' RRULE by reading rawVevent; the `create` branch
|
||||
// (used for the create half of an edit-as-move, D-04) has no source for the
|
||||
// original RRULE because it writes under a brand-new uid. The edit route extracts
|
||||
// the source event's RRULE and stashes it on the payload as `_preservedRrule` so
|
||||
// the worker can re-apply it here. An explicit `recurrence` on the payload still
|
||||
// wins (deliberate user change); the preserved RRULE only fills the gap when the
|
||||
// edit omitted recurrence — matching the update-branch semantics and the WR-01 fix.
|
||||
const hasExplicitRecurrence = Object.prototype.hasOwnProperty.call(fields, 'recurrence')
|
||||
const rruleFromPayload =
|
||||
fields.recurrence && fields.recurrence !== 'none'
|
||||
? RRULE_PRESETS[fields.recurrence as string]
|
||||
: undefined
|
||||
const preservedRrule =
|
||||
typeof fields._preservedRrule === 'string' && fields._preservedRrule.length > 0
|
||||
? fields._preservedRrule
|
||||
: undefined
|
||||
const { icsString } = buildVeventString({
|
||||
uid: row.uid,
|
||||
summary: fields.title as string,
|
||||
@@ -290,7 +307,7 @@ async function dispatchRow(row: OutboxRow): Promise<DispatchResult> {
|
||||
dtend: fields.allDay ? (fields.end as string) : new Date(fields.end as string),
|
||||
location: fields.location as string | undefined,
|
||||
description: fields.description as string | undefined,
|
||||
rruleString: fields.recurrence && fields.recurrence !== 'none' ? RRULE_PRESETS[fields.recurrence as string] : undefined,
|
||||
rruleString: hasExplicitRecurrence ? rruleFromPayload : (preservedRrule ?? rruleFromPayload),
|
||||
})
|
||||
// Build a minimal DAVCalendar for the write wrapper (only url is needed)
|
||||
const davCalendar = { url: row.calendarUrl } as Parameters<typeof createCalendarEvent>[1]
|
||||
|
||||
Reference in New Issue
Block a user