mirror of
https://github.com/nextcloud/server.git
synced 2026-03-01 13:00:44 -05:00
Merge pull request #27632 from nextcloud/chore/caldav-trashbin-iso-timestamps
Use ISO8601 timestamps for the CalDAV trashbin
This commit is contained in:
commit
d87248fe40
2 changed files with 20 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ declare(strict_types=1);
|
|||
namespace OCA\DAV\CalDAV\Trashbin;
|
||||
|
||||
use Closure;
|
||||
use DateTimeImmutable;
|
||||
use DateTimeInterface;
|
||||
use OCA\DAV\CalDAV\Calendar;
|
||||
use OCA\DAV\CalDAV\RetentionService;
|
||||
use OCP\IRequest;
|
||||
|
|
@ -101,7 +103,14 @@ class Plugin extends ServerPlugin {
|
|||
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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue