Skip to content

Commit fd59fff

Browse files
authored
Merge pull request #27508 from nextcloud/fix/noid/caldav-trash-filter-deleted-calendar
Skip deleted calendar objects of deleted calendars
2 parents cc4e663 + 09ad1c4 commit fd59fff

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

apps/dav/lib/CalDAV/CalDavBackend.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,14 +1098,23 @@ public function getDeletedCalendarObjects(int $deletedBefore): array {
10981098
return $result;
10991099
}
11001100

1101+
/**
1102+
* Return all deleted calendar objects by the given principal that are not
1103+
* in deleted calendars.
1104+
*
1105+
* @param string $principalUri
1106+
* @return array
1107+
* @throws \OCP\DB\Exception
1108+
*/
11011109
public function getDeletedCalendarObjectsByPrincipal(string $principalUri): array {
11021110
$query = $this->db->getQueryBuilder();
11031111
$query->select(['co.id', 'co.uri', 'co.lastmodified', 'co.etag', 'co.calendarid', 'co.size', 'co.componenttype', 'co.classification', 'co.deleted_at'])
11041112
->selectAlias('c.uri', 'calendaruri')
11051113
->from('calendarobjects', 'co')
11061114
->join('co', 'calendars', 'c', $query->expr()->eq('c.id', 'co.calendarid', IQueryBuilder::PARAM_INT))
11071115
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
1108-
->andWhere($query->expr()->isNotNull('co.deleted_at'));
1116+
->andWhere($query->expr()->isNotNull('co.deleted_at'))
1117+
->andWhere($query->expr()->isNull('c.deleted_at'));
11091118
$stmt = $query->executeQuery();
11101119

11111120
$result = [];

0 commit comments

Comments
 (0)