fix(project): set maxRight on projects after opening a task
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
kolaente 2023-06-21 15:09:31 +02:00
parent f55c42f124
commit 83c0ef4e8b
Signed by: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -11,6 +11,7 @@ import {useMenuActive} from '@/composables/useMenuActive'
import {useAuthStore} from '@/stores/auth' import {useAuthStore} from '@/stores/auth'
import type {IProject} from '@/modelTypes/IProject' import type {IProject} from '@/modelTypes/IProject'
import type {Right} from '@/constants/rights'
export const useBaseStore = defineStore('base', () => { export const useBaseStore = defineStore('base', () => {
const loading = ref(false) const loading = ref(false)
@ -38,6 +39,7 @@ export const useBaseStore = defineStore('base', () => {
// Server updates don't return the right. Therefore, the right is reset after updating the project which is // Server updates don't return the right. Therefore, the right is reset after updating the project which is
// confusing because all the buttons will disappear in that case. To prevent this, we're keeping the right // confusing because all the buttons will disappear in that case. To prevent this, we're keeping the right
// when updating the project in global state. // when updating the project in global state.
let maxRight: Right | null = newCurrentProject?.maxRight || null
if ( if (
typeof currentProject.value?.maxRight !== 'undefined' && typeof currentProject.value?.maxRight !== 'undefined' &&
newCurrentProject !== null && newCurrentProject !== null &&
@ -46,9 +48,16 @@ export const useBaseStore = defineStore('base', () => {
newCurrentProject.maxRight === null newCurrentProject.maxRight === null
) )
) { ) {
newCurrentProject.maxRight = currentProject.value.maxRight maxRight = currentProject.value.maxRight
}
if (newCurrentProject === null) {
currentProject.value = null
return
}
currentProject.value = {
...newCurrentProject,
maxRight,
} }
currentProject.value = newCurrentProject
} }
function setHasTasks(newHasTasks: boolean) { function setHasTasks(newHasTasks: boolean) {