Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix carddav sync-collection reporting wrong syncToken #3734

Merged
merged 8 commits into from
Mar 24, 2020
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
1 change: 1 addition & 0 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ jobs:
parallel: true
group: Azure DevOps CI
config: baseUrl=http://localhost:8000
wait-on: http://localhost:8000
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

### Fixes:

*
* Fix carddav sync-collection reporting wrong syncToken


# RELEASED VERSIONS:

Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/DAV/Backend/SyncDAVBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ public function getChanges($syncToken)

$timestamp = $token->timestamp;
} else {
$token = $this->createSyncTokenNow();
$timestamp = null;
}

Expand All @@ -184,7 +183,7 @@ public function getChanges($syncToken)
});

return [
'syncToken' => $token->id,
'syncToken' => $this->getCurrentSyncToken()->id,
'added' => $added->map(function ($obj) {
return $this->encodeUri($obj);
})->toArray(),
Expand Down
8 changes: 8 additions & 0 deletions tests/Api/DAV/CalDAVBirthdaysTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,14 @@ public function test_caldav_birthdays_sync_collection_with_token()

$response->assertStatus(207);

$token = SyncToken::where([
'account_id' => $user->account_id,
'user_id' => $user->id,
'name' => 'birthdays',
])
->orderBy('created_at')
->get()
->last();
$response->assertSee("<d:multistatus xmlns:d=\"DAV:\" xmlns:s=\"http://sabredav.org/ns\" xmlns:card=\"urn:ietf:params:xml:ns:carddav\" xmlns:cal=\"urn:ietf:params:xml:ns:caldav\" xmlns:cs=\"http://calendarserver.org/ns/\">
<d:response>
<d:href>/dav/calendars/{$user->email}/birthdays/{$specialDate->uuid}.ics</d:href>
Expand Down
8 changes: 8 additions & 0 deletions tests/Api/DAV/CalDAVTasksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ public function test_caldav_tasks_sync_collection_with_token()
);
$response->assertStatus(207);

$token = SyncToken::where([
'account_id' => $user->account_id,
'user_id' => $user->id,
'name' => 'tasks',
])
->orderBy('created_at')
->get()
->last();
$response->assertSee("<d:multistatus xmlns:d=\"DAV:\" xmlns:s=\"http://sabredav.org/ns\" xmlns:card=\"urn:ietf:params:xml:ns:carddav\" xmlns:cal=\"urn:ietf:params:xml:ns:caldav\" xmlns:cs=\"http://calendarserver.org/ns/\">
<d:response>
<d:href>/dav/calendars/{$user->email}/tasks/{$task->uuid}.ics</d:href>
Expand Down
9 changes: 9 additions & 0 deletions tests/Api/DAV/CardDAVTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,15 @@ public function test_carddav_sync_collection_with_token()

$response->assertStatus(207);

$token = SyncToken::where([
'account_id' => $user->account_id,
'user_id' => $user->id,
'name' => 'contacts',
])
->orderBy('created_at')
->get()
->last();

$response->assertSee("<d:multistatus xmlns:d=\"DAV:\" xmlns:s=\"http://sabredav.org/ns\" xmlns:card=\"urn:ietf:params:xml:ns:carddav\" xmlns:cal=\"urn:ietf:params:xml:ns:caldav\" xmlns:cs=\"http://calendarserver.org/ns/\">
<d:response>
<d:href>/dav/addressbooks/{$user->email}/contacts/{$contact->uuid}.vcf</d:href>
Expand Down