Skip to content

Commit 2099b1b

Browse files
fix(store/filters): use files_list_filter_* keys to match PHP config
PHP stores and reads filter config under files_list_filter_status and files_list_filter_modified (after migration Version17001Date20260210). The JS was using the old short keys in both loadState reads and PUT requests, so saved values were never read back on page load. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent b0d122e commit 2099b1b

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/store/filters.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import { getTimePresetRange } from '../utils/timePresets.js'
1515
export const useFiltersStore = defineStore('filter', {
1616
state: () => ({
1717
chips: {},
18-
filter_modified: loadState('libresign', 'filters', { filter_modified: '' }).filter_modified,
19-
filter_status: loadState('libresign', 'filters', { filter_status: '' }).filter_status,
18+
filter_modified: loadState('libresign', 'filters', {}).files_list_filter_modified ?? '',
19+
filter_status: loadState('libresign', 'filters', {}).files_list_filter_status ?? ''
2020
}),
2121

2222
getters: {
@@ -55,7 +55,7 @@ export const useFiltersStore = defineStore('filter', {
5555
if(event.id == 'modified'){
5656
let value = this.chips['modified'][0]?.id || '';
5757

58-
await axios.put(generateOcsUrl('/apps/libresign/api/v1/account/config/{key}', { key: 'filter_modified' }), {
58+
await axios.put(generateOcsUrl('/apps/libresign/api/v1/account/config/{key}', { key: 'files_list_filter_modified' }), {
5959
value,
6060
})
6161

@@ -68,7 +68,7 @@ export const useFiltersStore = defineStore('filter', {
6868

6969
const value = event.detail.length > 0 ? JSON.stringify(event.detail.map(item => item.id)) : '';
7070

71-
await axios.put(generateOcsUrl('/apps/libresign/api/v1/account/config/{key}', { key: 'filter_status' }), {
71+
await axios.put(generateOcsUrl('/apps/libresign/api/v1/account/config/{key}', { key: 'files_list_filter_status' }), {
7272
value,
7373
})
7474

src/tests/store/filters.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ describe('filters store - filter business rules', () => {
254254
await store.onFilterUpdateChipsAndSave(event)
255255

256256
expect(axiosMock.put).toHaveBeenCalledWith(
257-
'/ocs/v2.php/apps/libresign/api/v1/account/config/filter_modified',
257+
'/ocs/v2.php/apps/libresign/api/v1/account/config/files_list_filter_modified',
258258
{ value: 'today' }
259259
)
260260
})
@@ -274,7 +274,7 @@ describe('filters store - filter business rules', () => {
274274
await store.onFilterUpdateChipsAndSave(event)
275275

276276
expect(axiosMock.put).toHaveBeenCalledWith(
277-
'/ocs/v2.php/apps/libresign/api/v1/account/config/filter_modified',
277+
'/ocs/v2.php/apps/libresign/api/v1/account/config/files_list_filter_modified',
278278
{ value: 'today' }
279279
)
280280
})
@@ -291,7 +291,7 @@ describe('filters store - filter business rules', () => {
291291
await store.onFilterUpdateChipsAndSave(event)
292292

293293
expect(axiosMock.put).toHaveBeenCalledWith(
294-
'/ocs/v2.php/apps/libresign/api/v1/account/config/filter_modified',
294+
'/ocs/v2.php/apps/libresign/api/v1/account/config/files_list_filter_modified',
295295
{ value: '' }
296296
)
297297
})
@@ -342,7 +342,7 @@ describe('filters store - filter business rules', () => {
342342
await store.onFilterUpdateChipsAndSave(event)
343343

344344
expect(axiosMock.put).toHaveBeenCalledWith(
345-
'/ocs/v2.php/apps/libresign/api/v1/account/config/filter_status',
345+
'/ocs/v2.php/apps/libresign/api/v1/account/config/files_list_filter_status',
346346
{ value: '["signed","pending"]' }
347347
)
348348
})
@@ -359,7 +359,7 @@ describe('filters store - filter business rules', () => {
359359
await store.onFilterUpdateChipsAndSave(event)
360360

361361
expect(axiosMock.put).toHaveBeenCalledWith(
362-
'/ocs/v2.php/apps/libresign/api/v1/account/config/filter_status',
362+
'/ocs/v2.php/apps/libresign/api/v1/account/config/files_list_filter_status',
363363
{ value: '' }
364364
)
365365
})

0 commit comments

Comments
 (0)