Skip to content
Open
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
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
}
],
"require": {
"php": ">=5.6.0",
"audriga/jmap-openxport": "dev-7676-ietf_implementation",
"audriga/jmap-icalendar_vcard": "dev-7676-support_new_ietf",
"php": ">=8.0",
"audriga/jmap-openxport": "dev-next-gen",
"audriga/jmap-icalendar_vcard": "dev-next-gen",
"sabre/xml": "~2"
},
"require-dev": {
Expand Down
72 changes: 36 additions & 36 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions lib/jmap/data_access/NextcloudCalendarDataAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function create($calendarsToCreate, $accountId = null)
if (
is_null($calendarToCreate) ||
!array_key_exists('uri', $calendarToCreate) ||
strlen($calendarToCreate['uri'] == 0)
strlen($calendarToCreate['uri']) == 0
) {
$calendarMap[$creationId] = false;
continue;
Expand All @@ -113,8 +113,8 @@ public function create($calendarsToCreate, $accountId = null)

$uri = $this->stripInvalidCharactersFromUri($name);

$calendarMap[$creationId] =
$this->backend->createCalendar($this->principalUri, $uri, $calendarToCreate);
$newId = $this->backend->createCalendar($this->principalUri, $uri, $calendarToCreate);
$calendarMap[$creationId] = (string)$newId;
}

return $calendarMap;
Expand Down
27 changes: 24 additions & 3 deletions lib/jmap/data_access/NextcloudCalendarEventDataAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function getAll($accountId = null)
$res[$id] = [
"iCalendar" => $calendarEvent['calendardata'],
"oxpProperties" => [
"calendarId" => $calendarId
"calendarId" => (string)$calendarId
]
];
}
Expand Down Expand Up @@ -121,7 +121,7 @@ public function get($ids, $accountId = null)
$res[$id] = [
"iCalendar" => $calendarEvent['calendardata'],
"oxpProperties" => [
"calendarId" => $calendarId
"calendarId" => (string)$calendarId
]
];
} else {
Expand Down Expand Up @@ -190,7 +190,28 @@ public function create($eventsToCreate, $accountId = null)
$calendarId = $defaultCalendarId;
}
} else {
$calendarId = $eventToCreate["oxpProperties"]["calendarId"];
$rawCalendarId = $eventToCreate["oxpProperties"]["calendarId"];

// calendarIds from JSCalendar is a map like ["1" => true]; extract the first active key
if (is_array($rawCalendarId)) {
$activeIds = array_keys(array_filter($rawCalendarId));
$jmapId = !empty($activeIds) ? $activeIds[0] : null;

$calendarId = null;
foreach ($calendars as $cal) {
if ((string) $cal["id"] === (string) $jmapId) {
$calendarId = $cal["id"];
break;
}
}

if (is_null($calendarId)) {
$this->logger->warning("Calendar '$jmapId' not found. Falling back to default.");
$calendarId = $calendars[0]["id"];
}
} else {
$calendarId = $rawCalendarId;
}
}

// Create a URI for each event for it to be added to the server.
Expand Down
7 changes: 4 additions & 3 deletions lib/jmap/data_access/NextcloudContactDataAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function getAll($accountId = null)
$res[$id] = [
"vCard" => $contact['carddata'],
"oxpProperties" => [
"addressBookId" => $addressBookId
"addressBookId" => (string)$addressBookId
]
];
}
Expand Down Expand Up @@ -155,8 +155,9 @@ public function get($ids, $accountId = null)
if (!is_null($card) && !empty($card)) {
$result[$id] = [
'vCard' => $card['carddata'],
'uri' => $card['uri'],
'addressBookId' => $addressBookId
'oxpProperties' => [
'addressBookId' => (string)$addressBookId
]
];
} else {
$this->logger->warning("Contact not found: " . $id);
Expand Down
2 changes: 1 addition & 1 deletion lib/jmap/mapper/NextcloudAddressbookMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function mapToJmap($data, $adapter)
$adapter->setAddressbook($addressbook);

$jmapAddressbook = new AddressBook();
$jmapAddressbook->setId($adapter->getId());
$jmapAddressbook->setId((string)$adapter->getId());
$jmapAddressbook->setName($adapter->getName());
$jmapAddressbook->setDescription($adapter->getDescription());

Expand Down
2 changes: 1 addition & 1 deletion lib/jmap/mapper/NextcloudCalendarMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function mapToJmap($data, $adapter)
$adapter->setCalendar($calendar);

$jmapCalendar = new Calendar();
$jmapCalendar->setId($adapter->getId());
$jmapCalendar->setId((string)$adapter->getId());
$jmapCalendar->setName($adapter->getName());
$jmapCalendar->setDescription($adapter->getDescription());
// TODO https://web.audriga.com/mantis/view.php?id=6289
Expand Down