Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2021-05-31 21:01:07 +0300
committerGitHub <noreply@github.com>2021-05-31 21:01:07 +0300
commit4fc002a3a5b78bb7b832829dc9cf2c16f897263b (patch)
tree6dfedfc743c1afcab286a43e0ab4b512c0c4749b /apps
parentb908db7ac88a37fa5d9e98ae5ab570fac1b70063 (diff)
parent462962197d0d711abc7b57352d4ef24528e28096 (diff)
Merge pull request #27310 from nextcloud/enhancement/caldav-trashbin-objects-calendar-id
Expose calendar-uri as property of deleted caldav events
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php8
-rw-r--r--apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php4
-rw-r--r--apps/dav/lib/CalDAV/Trashbin/Plugin.php4
3 files changed, 14 insertions, 2 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index d278719190b..3ad0c2235cd 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -1101,6 +1101,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
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'])
+ ->selectAlias('c.uri', 'calendaruri')
->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)))
@@ -1111,10 +1112,11 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
while ($row = $stmt->fetch()) {
$result[] = [
'id' => $row['id'],
- 'uri' => $row['uri'],
+ 'uri' => $row['co.uri'],
'lastmodified' => $row['lastmodified'],
'etag' => '"' . $row['etag'] . '"',
'calendarid' => $row['calendarid'],
+ 'calendaruri' => $row['calendaruri'],
'size' => (int)$row['size'],
'component' => strtolower($row['componenttype']),
'classification' => (int)$row['classification'],
@@ -2139,6 +2141,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
public function getCalendarObjectById(string $principalUri, int $id): ?array {
$query = $this->db->getQueryBuilder();
$query->select(['co.id', 'co.uri', 'co.lastmodified', 'co.etag', 'co.calendarid', 'co.size', 'co.calendardata', 'co.componenttype', 'co.classification', 'co.deleted_at'])
+ ->selectAlias('c.uri', 'calendaruri')
->from('calendarobjects', 'co')
->join('co', 'calendars', 'c', $query->expr()->eq('c.id', 'co.calendarid', IQueryBuilder::PARAM_INT))
->where($query->expr()->eq('c.principaluri', $query->createNamedParameter($principalUri)))
@@ -2153,10 +2156,11 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
return [
'id' => $row['id'],
- 'uri' => $row['uri'],
+ 'uri' => $row['c.uri'],
'lastmodified' => $row['lastmodified'],
'etag' => '"' . $row['etag'] . '"',
'calendarid' => $row['calendarid'],
+ 'calendaruri' => $row['calendaruri'],
'size' => (int)$row['size'],
'calendardata' => $this->readBlob($row['calendardata']),
'component' => strtolower($row['componenttype']),
diff --git a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php
index 0517125ef48..c704f454e7f 100644
--- a/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php
+++ b/apps/dav/lib/CalDAV/Trashbin/DeletedCalendarObject.php
@@ -97,4 +97,8 @@ class DeletedCalendarObject implements ICalendarObject, IRestorable {
public function getDeletedAt(): ?int {
return $this->objectData['deleted_at'] ? (int) $this->objectData['deleted_at'] : null;
}
+
+ public function getCalendarUri(): string {
+ return $this->objectData['calendaruri'];
+ }
}
diff --git a/apps/dav/lib/CalDAV/Trashbin/Plugin.php b/apps/dav/lib/CalDAV/Trashbin/Plugin.php
index 7fd127479c5..fd47e1faa30 100644
--- a/apps/dav/lib/CalDAV/Trashbin/Plugin.php
+++ b/apps/dav/lib/CalDAV/Trashbin/Plugin.php
@@ -40,6 +40,7 @@ use function implode;
class Plugin extends ServerPlugin {
public const PROPERTY_DELETED_AT = '{http://nextcloud.com/ns}deleted-at';
+ public const PROPERTY_CALENDAR_URI = '{http://nextcloud.com/ns}calendar-uri';
/** @var bool */
private $disableTrashbin;
@@ -95,6 +96,9 @@ class Plugin extends ServerPlugin {
$propFind->handle(self::PROPERTY_DELETED_AT, function () use ($node) {
return $node->getDeletedAt();
});
+ $propFind->handle(self::PROPERTY_CALENDAR_URI, function () use ($node) {
+ return $node->getCalendarUri();
+ });
}
}