Fix lint
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
kolaente 2021-07-09 23:06:30 +02:00
parent 6316af12d8
commit a2353dc76f
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 12 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import (
"xorm.io/xorm"
)
// FavoriteKind represents the kind of entities that can be marked as favorite
type FavoriteKind int
const (
@ -31,12 +32,14 @@ const (
FavoriteKindList
)
// Favorite represents an entity which is a favorite to someone
type Favorite struct {
EntityID int64 `xorm:"bigint not null pk"`
UserID int64 `xorm:"bigint not null pk"`
Kind FavoriteKind `xorm:"int not null pk"`
}
// TableName is the table name
func (t *Favorite) TableName() string {
return "favorites"
}

View File

@ -552,6 +552,9 @@ func CreateOrUpdateList(s *xorm.Session, list *List, auth web.Auth) (err error)
if list.ID == 0 {
_, err = s.Insert(list)
if err != nil {
return
}
if list.IsFavorite {
if err := addToFavorites(s, list.ID, auth, FavoriteKindList); err != nil {
return err
@ -590,6 +593,9 @@ func CreateOrUpdateList(s *xorm.Session, list *List, auth web.Auth) (err error)
ID(list.ID).
Cols(colsToUpdate...).
Update(list)
if err != nil {
return err
}
}
if err != nil {

View File

@ -998,6 +998,9 @@ func (t *Task) Update(s *xorm.Session, a web.Auth) (err error) {
}
wasFavorite, err := isFavorite(s, t.ID, a, FavoriteKindTask)
if err != nil {
return
}
if t.IsFavorite && !wasFavorite {
if err := addToFavorites(s, t.ID, a, FavoriteKindTask); err != nil {
return err