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

feat: Query io.cozy.settings.bitwarden in SettingsCollection #1339

Merged
merged 1 commit into from
Apr 3, 2023
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
18 changes: 18 additions & 0 deletions packages/cozy-stack-client/src/SettingsCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@ class SettingsCollection extends DocumentCollection {
* @returns {object} The response from the route
*/
async get(id) {
// This is a dirty quick fix waiting for this issue to be resolved
// https://github.com/cozy/cozy-stack/issues/3864
if (id === 'io.cozy.settings.bitwarden') {
const resp = await this.stackClient.fetchJSON(
'GET',
'/data/io.cozy.settings/io.cozy.settings.bitwarden'
)
return {
data: DocumentCollection.normalizeDoctypeJsonApi(SETTINGS_DOCTYPE)(
{
id: '/data/io.cozy.settings/io.cozy.settings.bitwarden',
...resp
Crash-- marked this conversation as resolved.
Show resolved Hide resolved
},
resp
)
}
}

let path

if (id.startsWith('io.cozy.settings.')) {
Expand Down
6 changes: 6 additions & 0 deletions packages/cozy-stack-client/src/SettingsCollection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ describe('SettingsCollection', () => {
'GET',
'/settings/disk-usage'
)

await collection.get('io.cozy.settings.bitwarden')
expect(stackClient.fetchJSON).toHaveBeenCalledWith(
'GET',
'/data/io.cozy.settings/io.cozy.settings.bitwarden'
)
})

it('should format correctly the response', async () => {
Expand Down