Fix lint
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
This commit is contained in:
parent
6316af12d8
commit
a2353dc76f
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue