Skip to content

Commit

Permalink
Bug fix: Select the correct table based on CALENDAR_TYPE_CALENDAR
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Fischer <[email protected]>
  • Loading branch information
zero0cool0 committed Sep 9, 2023
1 parent 0411cc6 commit a0ca75a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -2277,11 +2277,13 @@ public function getCalendarObjectById(string $principalUri, int $id): ?array {
* @return array
*/
public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
return $this->atomic(function () use ($calendarId, $syncToken, $syncLevel, $limit, $calendarType) {
$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions';

return $this->atomic(function () use ($calendarId, $syncToken, $syncLevel, $limit, $calendarType, $table) {
// Current synctoken
$qb = $this->db->getQueryBuilder();
$qb->select('synctoken')
->from('calendars')
->from($table)
->where(
$qb->expr()->eq('id', $qb->createNamedParameter($calendarId))
);
Expand Down

0 comments on commit a0ca75a

Please sign in to comment.