Set default position when creating a list
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
kolaente 2021-07-27 21:49:58 +02:00
parent 02418c6fa5
commit 6bbd19266c
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 8 additions and 0 deletions

View File

@ -301,6 +301,7 @@ func (b *Bucket) Update(s *xorm.Session, a web.Auth) (err error) {
"title",
"limit",
"is_done_bucket",
"position",
).
Update(b)
return

View File

@ -566,6 +566,12 @@ func CreateOrUpdateList(s *xorm.Session, list *List, auth web.Auth) (err error)
if err != nil {
return
}
list.Position = calculateDefaultPosition(list.ID, list.Position)
_, err = s.Where("id = ?", list.ID).Update(list)
if err != nil {
return
}
if list.IsFavorite {
if err := addToFavorites(s, list.ID, auth, FavoriteKindList); err != nil {
return err
@ -579,6 +585,7 @@ func CreateOrUpdateList(s *xorm.Session, list *List, auth web.Auth) (err error)
"identifier",
"hex_color",
"background_file_id",
"position",
}
if list.Description != "" {
colsToUpdate = append(colsToUpdate, "description")