Ask the recurrenceId, which is the part that survives expansion

Rules alone were still wrong, in the other direction. A live 0.16.19 was
asked to expand a real weekly series: the occurrences come back carrying
no rule at all — only the master has one — and Stalwart spells that
master's rule "recurrenceRule", singular, not the RFC 8984 array ihasmail
looks for. So a genuine occurrence would have read as a one-off, and the
delete dialog would have offered to delete "this event" while deleting
the series.

What an occurrence does carry is a recurrenceId, which a one-off never
has. Master by its rule under either name, occurrence by its
recurrenceId. The tests carry the shapes the live server returned.
This commit is contained in:
2026-08-25 08:18:38 -07:00
parent 330cecfb04
commit 458eb118b4
3 changed files with 24 additions and 9 deletions
+8 -2
View File
@@ -19,9 +19,15 @@ describe("isRecurring", () => {
// and a base that is a different id. Neither makes it a series.
expect(isRecurring(ev({ id: "eaaaaai", baseEventId: "i" }))).toBe(false);
});
it("recognises a series by its recurrence rules", () => {
it("recognises a series by its rule, under either name", () => {
expect(isRecurring(ev({ recurrenceRules: [{ "@type": "RecurrenceRule", frequency: "weekly" }] }))).toBe(true);
expect(isRecurring(ev({ baseEventId: "ev1", recurrenceRules: [{ "@type": "RecurrenceRule", frequency: "daily" }] }))).toBe(true);
expect(isRecurring(ev({ excludedRecurrenceRules: [{ "@type": "RecurrenceRule", frequency: "monthly" }] }))).toBe(true);
// Stalwart 0.16 keeps a single rule under the singular name.
expect(isRecurring(ev({ recurrenceRule: { "@type": "RecurrenceRule", frequency: "weekly", count: 3 } }))).toBe(true);
});
it("recognises an occurrence, which arrives with no rule of its own", () => {
// A live 0.16.19 expands a weekly series into instances like this: an id
// per occurrence, a recurrenceId, and no rule attached.
expect(isRecurring(ev({ id: "iaaaaas", recurrenceId: "2030-03-11T10:00:00" }))).toBe(true);
});
});