Skip to content

Commit

Permalink
Fix/handle-duplicate-reminder
Browse files Browse the repository at this point in the history
Signed-off-by: hamza221 <hamzamahjoubi221@gmail.com>
  • Loading branch information
hamza221 committed Nov 24, 2023
1 parent 94d1a00 commit 7fa6779
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apps/dav/lib/CalDAV/Reminder/ReminderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,16 @@ private function getRemindersForVAlarm(VAlarm $valarm,
* @param array $reminders
*/
private function writeRemindersToDatabase(array $reminders): void {
$uniqueReminders = [];
$seen = [];
foreach ($reminders as $reminder) {
$key = $reminder['notification_date']. $reminder['event_hash'];
if(!isset($seen[$key])) {
$seen[$key] = true;
$uniqueReminders[] = $reminder;
}
}
foreach ($reminders as $uniqueReminders) {
$this->backend->insertReminder(
(int) $reminder['calendar_id'],
(int) $reminder['object_id'],
Expand Down

0 comments on commit 7fa6779

Please sign in to comment.