fix(navigation): make sure the Favorites project shows up when marking or unmarking a task as favorite
This commit is contained in:
parent
d898316918
commit
fd7d90b017
@ -100,14 +100,14 @@ describe('Task', () => {
|
|||||||
.should('contain', 'Success')
|
.should('contain', 'Success')
|
||||||
})
|
})
|
||||||
|
|
||||||
it.only('Can add a task to favorites', () => {
|
it('Can add a task to favorites', () => {
|
||||||
TaskFactory.create(1)
|
TaskFactory.create(1)
|
||||||
|
|
||||||
cy.visit('/projects/1/list')
|
cy.visit('/projects/1/list')
|
||||||
cy.get('.tasks .task .favorite')
|
cy.get('.tasks .task .favorite')
|
||||||
.first()
|
.first()
|
||||||
.click()
|
.click()
|
||||||
cy.get('.menu.namespaces-lists')
|
cy.get('.menu-container')
|
||||||
.should('contain', 'Favorites')
|
.should('contain', 'Favorites')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -257,6 +257,7 @@ function undoDone(checked: boolean) {
|
|||||||
async function toggleFavorite() {
|
async function toggleFavorite() {
|
||||||
task.value.isFavorite = !task.value.isFavorite
|
task.value.isFavorite = !task.value.isFavorite
|
||||||
task.value = await taskService.update(task.value)
|
task.value = await taskService.update(task.value)
|
||||||
|
await projectStore.loadProjects() // reloading the projects list so that the Favorites project shows up or is hidden when there are (or are not) favorite tasks
|
||||||
emit('task-updated', task.value)
|
emit('task-updated', task.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,10 +146,11 @@ export const useProjectStore = defineStore('project', () => {
|
|||||||
|
|
||||||
const projectService = new ProjectService()
|
const projectService = new ProjectService()
|
||||||
try {
|
try {
|
||||||
const projects = await projectService.getAll({}, {is_archived: true}) as IProject[]
|
const loadedProjects = await projectService.getAll({}, {is_archived: true}) as IProject[]
|
||||||
setProjects(projects)
|
projects.value = {}
|
||||||
|
setProjects(loadedProjects)
|
||||||
|
|
||||||
return projects
|
return loadedProjects
|
||||||
} finally {
|
} finally {
|
||||||
cancel()
|
cancel()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user