fix: keep an HTML description's format when duplicating an event

This commit is contained in:
Linus Rath
2026-11-02 22:52:04 +01:00
parent 7ab900a0f7
commit f6e0b760d5
2 changed files with 8 additions and 0 deletions
+6
View File
@@ -28,6 +28,12 @@ describe('buildDuplicateEventData', () => {
expect(data.virtualLocations).not.toBe(virtualLocations);
});
// Without the type the copy's HTML would be stored, and shown, as text.
it('keeps the format of an HTML description', () => {
const data = buildDuplicateEventData(makeEvent({ description: '<p>Daily</p>', descriptionContentType: 'text/html' }));
expect(data).toMatchObject({ description: '<p>Daily</p>', descriptionContentType: 'text/html' });
});
it('moves a timed event one day later in its own time zone with a fresh uid', () => {
const data = buildDuplicateEventData(makeEvent());
expect(data).toMatchObject({
+2
View File
@@ -24,6 +24,8 @@ export function buildDuplicateEventData(event: CalendarEvent): Partial<CalendarE
freeBusyStatus: event.freeBusyStatus,
privacy: event.privacy,
};
// Without its type an HTML description would be stored as plain text.
if (event.descriptionContentType) data.descriptionContentType = event.descriptionContentType;
if (event.locations) data.locations = structuredClone(event.locations);
if (event.virtualLocations) data.virtualLocations = structuredClone(event.virtualLocations);
if (event.recurrenceRules) data.recurrenceRules = structuredClone(event.recurrenceRules);