Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions apps/dav/lib/CalDAV/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
*/
namespace OCA\DAV\CalDAV;

use DateTimeImmutable;
use DateTimeInterface;
use OCA\DAV\CalDAV\Trashbin\Plugin as TrashbinPlugin;
use OCA\DAV\DAV\Sharing\IShareable;
use OCA\DAV\Exception\UnsupportedLimitOnInitialSyncException;
use OCP\IConfig;
Expand Down Expand Up @@ -63,6 +66,13 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable
* @param IConfig $config
*/
public function __construct(BackendInterface $caldavBackend, $calendarInfo, IL10N $l10n, IConfig $config) {
// Convert deletion date to ISO8601 string
if (isset($calendarInfo[TrashbinPlugin::PROPERTY_DELETED_AT])) {
$calendarInfo[TrashbinPlugin::PROPERTY_DELETED_AT] = (new DateTimeImmutable())
->setTimestamp($calendarInfo[TrashbinPlugin::PROPERTY_DELETED_AT])
->format(DateTimeInterface::ATOM);
}

parent::__construct($caldavBackend, $calendarInfo);

if ($this->getName() === BirthdayService::BIRTHDAY_CALENDAR_URI) {
Expand Down
11 changes: 10 additions & 1 deletion apps/dav/lib/CalDAV/Trashbin/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
namespace OCA\DAV\CalDAV\Trashbin;

use Closure;
use DateTimeImmutable;
use DateTimeInterface;
use OCA\DAV\CalDAV\Calendar;
use OCA\DAV\CalDAV\RetentionService;
use OCP\IRequest;
Expand Down Expand Up @@ -101,7 +103,14 @@ private function propFind(
INode $node): void {
if ($node instanceof DeletedCalendarObject) {
$propFind->handle(self::PROPERTY_DELETED_AT, function () use ($node) {
return $node->getDeletedAt();
$ts = $node->getDeletedAt();
if ($ts === null) {
return null;
}

return (new DateTimeImmutable())
->setTimestamp($ts)
->format(DateTimeInterface::ATOM);
});
$propFind->handle(self::PROPERTY_CALENDAR_URI, function () use ($node) {
return $node->getCalendarUri();
Expand Down