mirror of
https://github.com/go-gitea/gitea
synced 2024-11-19 02:29:30 +01:00
Follow delvh's suggestion
This commit is contained in:
parent
f280c9bd98
commit
b6fccc0581
@ -9,8 +9,8 @@ import (
|
||||
"fmt"
|
||||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/modules/container"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
)
|
||||
|
||||
// ProjectIssue saves relation from issue to a project
|
||||
@ -115,11 +115,11 @@ func (b *Board) moveIssuesToAnotherColumn(ctx context.Context, newColumn *Board)
|
||||
return err
|
||||
}
|
||||
|
||||
// MoveColumnsOnProject moves or keeps column in a project and sorts them inside that column
|
||||
// MoveColumnsOnProject sorts columns in a project
|
||||
func MoveColumnsOnProject(ctx context.Context, project *Project, sortedColumnIDs map[int64]int64) error {
|
||||
return db.WithTx(ctx, func(ctx context.Context) error {
|
||||
sess := db.GetEngine(ctx)
|
||||
columnIDs := container.MapValues(sortedColumnIDs)
|
||||
columnIDs := util.ValuesOfMap(sortedColumnIDs)
|
||||
movedColumns, err := GetColumnsByIDs(ctx, project.ID, columnIDs)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -1,14 +0,0 @@
|
||||
// Copyright 2024 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package container
|
||||
|
||||
// MapValues returns a slice of all values in a map.
|
||||
// TODO: remove this after Golang std lib has similar function but not golang.org/x/exp
|
||||
func MapValues[K comparable, V any](m map[K]V) []V {
|
||||
values := make([]V, 0, len(m))
|
||||
for _, v := range m {
|
||||
values = append(values, v)
|
||||
}
|
||||
return values
|
||||
}
|
Loading…
Reference in New Issue
Block a user