fix(views): make bucket edit work

This commit is contained in:
kolaente 2024-03-16 15:19:17 +01:00
parent 445f1c06fa
commit 27cb6e3372
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 14 additions and 15 deletions

View File

@ -346,18 +346,6 @@ export const useKanbanStore = defineStore('kanban', () => {
}
}
async function updateBucketTitle({id, title}: { id: IBucket['id'], title: IBucket['title'] }) {
const bucket = findById(buckets.value, id)
if (bucket?.title === title) {
// bucket title has not changed
return
}
await updateBucket({id, title})
success({message: i18n.global.t('project.kanban.bucketTitleSavedSuccess')})
}
return {
buckets,
isLoading: readonly(isLoading),
@ -376,7 +364,6 @@ export const useKanbanStore = defineStore('kanban', () => {
createBucket,
deleteBucket,
updateBucket,
updateBucketTitle,
}
})

View File

@ -304,6 +304,7 @@ import type {TaskFilterParams} from '@/services/taskCollection'
import type {IProjectView} from '@/modelTypes/IProjectView'
import TaskPositionService from '@/services/taskPosition'
import TaskPositionModel from '@/models/taskPosition'
import {i18n} from '@/i18n'
const {
projectId,
@ -615,10 +616,19 @@ async function focusBucketTitle(e: Event) {
}
async function saveBucketTitle(bucketId: IBucket['id'], bucketTitle: string) {
await kanbanStore.updateBucketTitle({
const bucket = kanbanStore.getBucketById(bucketId)
if (bucket?.title === bucketTitle) {
bucketTitleEditable.value = false
return
}
await kanbanStore.updateBucket({
id: bucketId,
title: bucketTitle,
projectId,
})
success({message: i18n.global.t('project.kanban.bucketTitleSavedSuccess')})
bucketTitleEditable.value = false
}
@ -638,6 +648,7 @@ function updateBucketPosition(e: { newIndex: number }) {
kanbanStore.updateBucket({
id: bucket.id,
projectId,
position: calculateItemPosition(
bucketBefore !== null ? bucketBefore.position : null,
bucketAfter !== null ? bucketAfter.position : null,
@ -652,6 +663,7 @@ async function saveBucketLimit(bucketId: IBucket['id'], limit: number) {
await kanbanStore.updateBucket({
...kanbanStore.getBucketById(bucketId),
projectId,
limit,
})
success({message: t('project.kanban.bucketLimitSavedSuccess')})

View File

@ -48,7 +48,7 @@ func (b *Bucket) canDoBucket(s *xorm.Session, a web.Auth) (bool, error) {
}
pv := &ProjectView{
ID: bb.ProjectViewID,
ProjectID: bb.ProjectID,
ProjectID: b.ProjectID,
}
return pv.CanUpdate(s, a)
}