fix(views): make bucket edit work
This commit is contained in:
parent
445f1c06fa
commit
27cb6e3372
@ -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,
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -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')})
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user