mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-04-30 16:28:23 -05:00
feat(kanban): add setting to always show bucket task count (#1966)
Added "Always show task count on Kanban buckets" setting in user preferences to control the visibility of task counts on Kanban bucket headers
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type {APIRequestContext} from '@playwright/test'
|
||||
import {objectToSnakeCase} from '../../src/helpers/case'
|
||||
|
||||
export async function updateUserSettings(apiContext: APIRequestContext, token: string, settings: any) {
|
||||
const apiUrl = process.env.API_URL || 'http://localhost:3456/api/v1'
|
||||
@@ -9,15 +10,30 @@ export async function updateUserSettings(apiContext: APIRequestContext, token: s
|
||||
},
|
||||
})
|
||||
|
||||
const oldSettings = await userResponse.json()
|
||||
const userData = await userResponse.json()
|
||||
// GET /user returns { settings: { frontend_settings: ... }, ... }
|
||||
// POST /user/settings/general expects { frontend_settings: ... } at the top level
|
||||
const oldSettings = userData.settings || {}
|
||||
|
||||
const snakeSettings = objectToSnakeCase(settings)
|
||||
|
||||
// Deep merge frontend_settings if provided
|
||||
const mergedSettings = {
|
||||
...oldSettings,
|
||||
...snakeSettings,
|
||||
}
|
||||
|
||||
if (snakeSettings.frontend_settings) {
|
||||
mergedSettings.frontend_settings = {
|
||||
...(oldSettings.frontend_settings || {}),
|
||||
...snakeSettings.frontend_settings,
|
||||
}
|
||||
}
|
||||
|
||||
await apiContext.post(`${apiUrl}/user/settings/general`, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`,
|
||||
},
|
||||
data: {
|
||||
...oldSettings,
|
||||
...settings,
|
||||
},
|
||||
data: mergedSettings,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user