Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: expand select and group by for calendar reminder backend #47399

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/dav/lib/CalDAV/Reminder/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ public function __construct(IDBConnection $db,
*/
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(
Expand Down
14 changes: 8 additions & 6 deletions apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function testGetRemindersToProcess(): void {
unset($rows[0]['id']);
unset($rows[1]['id']);

$this->assertEquals($rows[0], [
$expected1 = [
'calendar_id' => 1,
'object_id' => 1,
'uid' => 'asd',
Expand All @@ -127,15 +127,15 @@ public function testGetRemindersToProcess(): void {
'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',
Expand All @@ -144,14 +144,16 @@ public function testGetRemindersToProcess(): void {
'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 {
Expand Down
Loading