diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2024-09-19 17:28:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-19 17:28:42 +0200 |
commit | 4bd9b936a94e738ce3845190d1a9148199a394ac (patch) | |
tree | e6f472ef682d7b036ee670fa988079dcafcc78fc /apps | |
parent | 10da080435339f1883afba7ad69146e2829009d8 (diff) | |
parent | 2f2394cfa995bba08cdc9f1f945875a437110a9e (diff) | |
download | nextcloud-server-4bd9b936a94e738ce3845190d1a9148199a394ac.tar.gz nextcloud-server-4bd9b936a94e738ce3845190d1a9148199a394ac.zip |
Merge pull request #48211 from nextcloud/backport/47399/stable30
[stable30] fix: expand select and group by for calendar reminder backend
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/CalDAV/Reminder/Backend.php | 4 | ||||
-rw-r--r-- | apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php | 14 |
2 files changed, 10 insertions, 8 deletions
diff --git a/apps/dav/lib/CalDAV/Reminder/Backend.php b/apps/dav/lib/CalDAV/Reminder/Backend.php index a4f3c7c6e12..0697bb21db3 100644 --- a/apps/dav/lib/CalDAV/Reminder/Backend.php +++ b/apps/dav/lib/CalDAV/Reminder/Backend.php @@ -44,12 +44,12 @@ class Backend { */ public function getRemindersToProcess():array { $query = $this->db->getQueryBuilder(); - $query->select(['cr.*', 'co.calendardata', 'c.displayname', 'c.principaluri','cr.notification_date', 'cr.event_hash', 'cr.type']) + $query->select(['cr.id', 'cr.calendar_id','cr.object_id','cr.is_recurring','cr.uid','cr.recurrence_id','cr.is_recurrence_exception','cr.event_hash','cr.alarm_hash','cr.type','cr.is_relative','cr.notification_date','cr.is_repeat_based','co.calendardata', 'c.displayname', 'c.principaluri']) ->from('calendar_reminders', 'cr') ->where($query->expr()->lte('cr.notification_date', $query->createNamedParameter($this->timeFactory->getTime()))) ->join('cr', 'calendarobjects', 'co', $query->expr()->eq('cr.object_id', 'co.id')) ->join('cr', 'calendars', 'c', $query->expr()->eq('cr.calendar_id', 'c.id')) - ->groupBy('cr.event_hash', 'cr.notification_date', 'cr.type'); + ->groupBy('cr.event_hash', 'cr.notification_date', 'cr.type', 'cr.id', 'cr.calendar_id', 'cr.object_id', 'cr.is_recurring', 'cr.uid', 'cr.recurrence_id', 'cr.is_recurrence_exception', 'cr.alarm_hash', 'cr.is_relative', 'cr.is_repeat_based', 'co.calendardata', 'c.displayname', 'c.principaluri'); $stmt = $query->execute(); return array_map( diff --git a/apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php b/apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php index 9900c77bf54..1bf94713966 100644 --- a/apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php +++ b/apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php @@ -118,7 +118,7 @@ class BackendTest extends TestCase { unset($rows[0]['id']); unset($rows[1]['id']); - $this->assertEquals($rows[0], [ + $expected1 = [ 'calendar_id' => 1, 'object_id' => 1, 'uid' => 'asd', @@ -127,15 +127,15 @@ class BackendTest extends TestCase { 'is_recurrence_exception' => false, 'event_hash' => 'asd123', 'alarm_hash' => 'asd567', - 'type' => 'AUDIO', + 'type' => 'EMAIL', 'is_relative' => true, 'notification_date' => 123456, 'is_repeat_based' => false, 'calendardata' => 'Calendar data 123', 'displayname' => 'Displayname 123', 'principaluri' => 'principals/users/user001', - ]); - $this->assertEquals($rows[1], [ + ]; + $expected2 = [ 'calendar_id' => 1, 'object_id' => 1, 'uid' => 'asd', @@ -144,14 +144,16 @@ class BackendTest extends TestCase { 'is_recurrence_exception' => false, 'event_hash' => 'asd123', 'alarm_hash' => 'asd567', - 'type' => 'EMAIL', + 'type' => 'AUDIO', 'is_relative' => true, 'notification_date' => 123456, 'is_repeat_based' => false, 'calendardata' => 'Calendar data 123', 'displayname' => 'Displayname 123', 'principaluri' => 'principals/users/user001', - ]); + ]; + + $this->assertEqualsCanonicalizing([$rows[0],$rows[1]], [$expected1,$expected2]); } public function testGetAllScheduledRemindersForEvent(): void { |