https://bugs.kde.org/show_bug.cgi?id=529136

            Bug ID: 529136
           Summary: Reminder fires at the original time of a moved
                    occurrence of a recurring event
    Classification: Frameworks and Libraries
           Product: Reminder Daemon
      Version First 5.24.5
       Reported In:
          Platform: Ubuntu
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

SUMMARY
When a single occurrence of a recurring event is moved (it becomes an exception
with a RECURRENCE-ID), kalendarac still fires the reminder at the occurrence's
original time. The moved occurrence's own reminder also fires at the new time,
so the user gets a reminder for a meeting that isn't there anymore.

STEPS TO REPRODUCE
1. Create a recurring event with a reminder, e.g. monthly on the 3rd Thursday
at 15:30 with an alarm at start time.
2. Move one upcoming occurrence to another day (here, Nov 19 15:30 moved to Dec
1 15:30). I did this in Outlook/Exchange, synced through DavMail and the DAV
groupware resource. The resulting Akonadi items are a series master with RRULE
and no EXDATE, plus a separate exception VEVENT with
RECURRENCE-ID:20261119T213000Z, DTSTART Dec 1 15:30, and its own VALARM. That's
standard RFC 5545 and what any CalDAV server sends for a moved occurrence.
3. Wait for the original time.

OBSERVED RESULT
At Nov 19 15:30 kalendarac shows a reminder for the moved occurrence. Akonadi
had the exception for over 30 minutes before that, and kalendarac reads it
every minute, so this isn't sync lag.

EXPECTED RESULT
No reminder at the original time. One reminder at the new time (Dec 1 15:30)
that shows the new start time.

CAUSE
KalendarAlarmClient::checkAlarms() takes the list from Calendar::alarms(). For
a recurring incidence, KCalendarCore's Calendar::appendRecurringAlarms()
expands the master's recurrence rule without looking at exceptions, so the
overridden occurrence still yields an alarm. checkAlarms() then resolves the
alarm with mCalendar->incidence(uid), which always returns the master. As a
result, when the exception's own alarm fires, occurrenceForAlarm() computes an
occurrence from the master's rule. That gives the next regular occurrence (Dec
17) instead of the exception's start, which is bug 439803.

PATCH
The attached patch changes only reminder-daemon/kalendaralarmclient.cpp:
- If the alarm belongs to one of the master's exceptions
(Calendar::instances()), use the exception's dtStart as the occurrence and run
shouldNotify() on the exception.
- If the alarm belongs to the master and Calendar::incidence(uid, occurrence)
returns an exception for the computed occurrence, skip it, because that
exception carries its own alarm.

TESTING
I've run the patch against 23.08.5 (Ubuntu 24.04 package rebuilt with it) and
checked it with a small harness that runs the same logic over the real master
and exception payloads from Akonadi:

  window Nov 19 15:30 (original slot): stock rings, patched skips
  window Dec  1 15:30 (moved slot):    stock rings showing Dec 17, patched
rings showing Dec 1
  window Dec 17 15:30 (normal slot):   both ring, Dec 17

The attached version is rebased onto current master (15188d60). checkAlarms()
there has the same structure, plus the shouldNotify() check, which the patch
keeps. I haven't compiled it against KF6 locally, but it only uses
Calendar::instances(), Calendar::incidence(uid, recurrenceId) and
Incidence::alarms(), which have the same signatures in KF6 KCalendarCore
master.

A fix in KCalendarCore's appendRecurringAlarms() would be another option. I
kept the change in the reminder daemon because other Calendar::alarms() users
may rely on the current behavior.

Related: bug 439803 (wrong time shown for a moved occurrence's reminder), which
this patch also fixes.

SOFTWARE/OS VERSIONS
Linux: Ubuntu 24.04
KDE PIM / akonadi-calendar: 23.08.5 (also present in current master)
KDE Frameworks / KCalendarCore: 5.115.0
Qt: 5.15.13

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to