summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRichard Steinmetz <richard@steinmetz.cloud>2021-06-15 11:35:03 +0200
committerRichard Steinmetz <richard@steinmetz.cloud>2021-06-15 11:36:59 +0200
commit09ad1c4e2be3f96c759106e8b1ad487cb92c931e (patch)
tree36b43b4ae4f36196230c2794facd283b7c825530 /apps
parenteb4e4c462b4d72833aec1f2ba4b97ffe52d1387e (diff)
downloadnextcloud-server-09ad1c4e2be3f96c759106e8b1ad487cb92c931e.tar.gz
nextcloud-server-09ad1c4e2be3f96c759106e8b1ad487cb92c931e.zip
Skip deleted calendar objects of deleted calendars
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index 4bb75e3431a..5f0c1bf3c48 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -1098,6 +1098,14 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
return $result;
}
+ /**
+ * Return all deleted calendar objects by the given principal that are not
+ * in deleted calendars.
+ *
+ * @param string $principalUri
+ * @return array
+ * @throws \OCP\DB\Exception
+ */
public function getDeletedCalendarObjectsByPrincipal(string $principalUri): array {
$query = $this->db->getQueryBuilder();
$query->select(['co.id', 'co.uri', 'co.lastmodified', 'co.etag', 'co.calendarid', 'co.size', 'co.componenttype', 'co.classification', 'co.deleted_at'])
@@ -1105,7 +1113,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->from('calendarobjects', 'co')
->join('co', 'calendars', 'c', $query->expr()->eq('c.id', 'co.calendarid', IQueryBuilder::PARAM_INT))
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
- ->andWhere($query->expr()->isNotNull('co.deleted_at'));
+ ->andWhere($query->expr()->isNotNull('co.deleted_at'))
+ ->andWhere($query->expr()->isNull('c.deleted_at'));
$stmt = $query->executeQuery();
$result = [];