Skip to content

Comments

feat(dav): update a principal's schedule-default-calendar-URL#43745

Merged
st3iny merged 1 commit intomasterfrom
feat/dav/write-default-calendar-url
Feb 28, 2024
Merged

feat(dav): update a principal's schedule-default-calendar-URL#43745
st3iny merged 1 commit intomasterfrom
feat/dav/write-default-calendar-url

Conversation

@st3iny
Copy link
Member

@st3iny st3iny commented Feb 21, 2024

Summary

Allow updating a principal's schedule-default-calendar-URL via a PROPPATCH. The property will be saved in oc_properties.

TODO

  • Adjust existing tests
  • Write new tests

Checklist

@st3iny st3iny added enhancement 2. developing Work in progress labels Feb 21, 2024
@st3iny st3iny self-assigned this Feb 21, 2024
@st3iny st3iny added the feature: caldav Related to CalDAV internals label Feb 21, 2024
@st3iny st3iny added this to the Nextcloud 29 milestone Feb 21, 2024
// Try to parse a more specialized property type first
if ($value instanceof Complex) {
$xml = $this->xmlService->write($name, [$value], $this->server->getBaseUri());
$value = $this->xmlService->parse($xml, $this->server->getBaseUri()) ?? $value;

Check notice

Code scanning / Psalm

RedundantConditionGivenDocblockType

Docblock-defined type array<array-key, mixed>|object|string for $<tmp coalesce var>15483 is never null
// Try to parse a more specialized property type first
if ($value instanceof Complex) {
$xml = $this->xmlService->write($name, [$value], $this->server->getBaseUri());
$value = $this->xmlService->parse($xml, $this->server->getBaseUri()) ?? $value;

Check notice

Code scanning / Psalm

DocblockTypeContradiction

Cannot resolve types for $<tmp coalesce var>15483 - docblock-defined type array<array-key, mixed>|object|string does not contain null
}

if ($name === '{urn:ietf:params:xml:ns:caldav}schedule-default-calendar-URL') {
$value = $this->encodeDefaultCalendarUrl($value);

Check notice

Code scanning / Psalm

PossiblyInvalidArgument

Argument 1 of OCA\DAV\DAV\CustomPropertiesBackend::encodeDefaultCalendarUrl expects Sabre\DAV\Xml\Property\Href, but possibly different type array<array-key, mixed>|mixed|object|string provided
@st3iny st3iny force-pushed the feat/dav/write-default-calendar-url branch from d7a272d to 69bd8be Compare February 27, 2024 22:32
@st3iny st3iny changed the title feat(dav): implement updating a principal's schedule-default-calendar… feat(dav): update a principal's schedule-default-calendar-URL Feb 27, 2024
@st3iny st3iny added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Feb 28, 2024
@st3iny st3iny marked this pull request as ready for review February 28, 2024 08:26
@st3iny
Copy link
Member Author

st3iny commented Feb 28, 2024

(Code style fixes are resolved locally. I'll push later to prevent wasting CI time.)

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean ✨

Comment on lines +79 to +87
Scenario: Update a principal's schedule-default-calendar-URL
Given user "user0" exists
And "user0" creates a calendar named "MyCalendar2"
When "user0" updates property "{urn:ietf:params:xml:ns:caldav}schedule-default-calendar-URL" to href "/remote.php/dav/calendars/user0/MyCalendar2/" of principal "users/user0" on the endpoint "/remote.php/dav/principals/"
Then The CalDAV response should be multi status
And The CalDAV response should contain a property "{urn:ietf:params:xml:ns:caldav}schedule-default-calendar-URL"
When "user0" requests principal "users/user0" on the endpoint "/remote.php/dav/principals/"
Then The CalDAV response should be multi status
And The CalDAV response should contain a property "{urn:ietf:params:xml:ns:caldav}schedule-default-calendar-URL" with a href value "/remote.php/dav/calendars/user0/MyCalendar2/"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@st3iny st3iny force-pushed the feat/dav/write-default-calendar-url branch from 69bd8be to 53ef6c5 Compare February 28, 2024 13:51
@st3iny st3iny added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Feb 28, 2024
@st3iny st3iny merged commit 0304330 into master Feb 28, 2024
@st3iny st3iny deleted the feat/dav/write-default-calendar-url branch February 28, 2024 19:08
@blizzz blizzz mentioned this pull request Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish enhancement feature: caldav Related to CalDAV internals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants