]> source.dussan.org Git - nextcloud-server.git/commitdiff
ensure outerquery ->where() function doesn't clobber earier ->andWhere() 39788/head
authorJamie McClelland <jm@mayfirst.org>
Mon, 7 Aug 2023 17:35:08 +0000 (13:35 -0400)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Thu, 10 Aug 2023 07:52:04 +0000 (07:52 +0000)
Signed-off-by: Jamie McClelland <jm@mayfirst.org>
apps/dav/lib/CalDAV/CalDavBackend.php

index 8b1e3ac6ea9efd129a5390dc82956eae184976bd..8df8bbb7d03e07d18611b7defe7d4868149b6b73 100644 (file)
@@ -1824,6 +1824,10 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
                        ->andWhere($innerQuery->expr()->eq('op.calendartype',
                                $outerQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
 
+               $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri')
+                       ->from('calendarobjects', 'c')
+                       ->where($outerQuery->expr()->isNull('deleted_at'));
+
                // only return public items for shared calendars for now
                if (isset($calendarInfo['{http://owncloud.org/ns}owner-principal']) === false || $calendarInfo['principaluri'] !== $calendarInfo['{http://owncloud.org/ns}owner-principal']) {
                        $outerQuery->andWhere($outerQuery->expr()->eq('c.classification',
@@ -1845,10 +1849,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
                                        $this->db->escapeLikeParameter($pattern) . '%')));
                }
 
-               $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri')
-                       ->from('calendarobjects', 'c')
-                       ->where($outerQuery->expr()->isNull('deleted_at'));
-
                if (isset($options['timerange'])) {
                        if (isset($options['timerange']['start']) && $options['timerange']['start'] instanceof DateTimeInterface) {
                                $outerQuery->andWhere($outerQuery->expr()->gt('lastoccurence',