Fix #165 Remove for now text/vcard header constraint

This commit is contained in:
Timothée Jaussoin 2024-04-25 09:05:05 +00:00
parent debf668e77
commit 911862870c
4 changed files with 18 additions and 16 deletions

View file

@ -2,6 +2,7 @@
v1.5
----
- Fix FLEXIAPI-165 Remove for now text/vcard header constraint
- Fix FLEXIAPI-164 Add vcards-storage endpoints
- Fix FLEXIAPI-162 Drop the aliases table and migrate the data to the phone column
- Fix FLEXIAPI-161 Complete the Dictionary tests to cover the collection accessor

View file

@ -9,7 +9,7 @@ class VcardsStorageController extends Controller
{
public function index(Request $request)
{
if ($this->vcardRequested($request)) {
//if ($this->vcardRequested($request)) {
$vcards = '';
foreach ($request->user()->vcardsStorage()->get() as $vcard) {
@ -17,21 +17,21 @@ class VcardsStorageController extends Controller
}
return $vcards;
}
/*}
abort(404);
abort(404);*/
}
public function show(Request $request, string $uuid)
{
return ($this->vcardRequested($request))
? $request->user()->vcardsStorage()->where('uuid', $uuid)->firstOrFail()->vcard
: abort(404);
return /*($this->vcardRequested($request))
?*/ $request->user()->vcardsStorage()->where('uuid', $uuid)->firstOrFail()->vcard
/*: abort(404)*/;
}
private function vcardRequested(Request $request): bool
/*private function vcardRequested(Request $request): bool
{
return $request->hasHeader('content-type') == 'text/vcard'
&& $request->hasHeader('accept') == 'text/vcard';
}
}*/
}

View file

@ -763,12 +763,13 @@ Return a specific user authenticated contact, in [vCard 4.0 format](https://data
## vCards Storage
<!---
The following headers are mandatory to access the following endpoints:
```
> content-type: text/vcard
> accept: text/vcard
```
--->
### `GET /vcards-storage`

View file

@ -40,7 +40,7 @@ FN:Simone Perreault
UID:' . $uid . '
END:VCARD
';
$uid2 = 'urn:uuid: a5b33443-687c-4d19-bdd0-b30cf76bf96d';
$uid2 = 'urn:uuid:a5b33443-687c-4d19-bdd0-b30cf76bf96d';
$secondVcard =
'BEGIN:VCARD
VERSION:4.0
@ -136,25 +136,25 @@ END:VCARD'
]);
// Vcard format endpoints
$this->keyAuthenticated($account)
/*$this->keyAuthenticated($account)
->get('vcards-storage')
->assertStatus(404);
->assertStatus(404);*/
$this->keyAuthenticated($account)
->withHeaders([
/*->withHeaders([
'content-type' => 'text/vcard',
'accept' => 'text/vcard',
])
])*/
->get('vcards-storage')
->assertStatus(200)
->assertSee($lastVcard)
->assertSee($secondVcard);
$this->keyAuthenticated($account)
->withHeaders([
/*->withHeaders([
'content-type' => 'text/vcard',
'accept' => 'text/vcard',
])
])*/
->get('vcards-storage/' . $uid)
->assertStatus(200)
->assertSee($lastVcard);