🐛 Fix flags
This commit is contained in:
parent
63c42befb4
commit
ba6e827cf8
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func NewFlag(post models.Post, account uint) (models.PostFlag, error) {
|
func NewFlag(post models.Post, account uint) (models.PostFlag, error) {
|
||||||
var flag models.PostFlag
|
var flag models.PostFlag
|
||||||
if err := database.C.Where("post_id = ? AND account_id = ?", post.ID, account).Error; err == nil {
|
if err := database.C.Where("post_id = ? AND account_id = ?", post.ID, account).First(&flag).Error; err == nil {
|
||||||
return flag, fmt.Errorf("flag already exists")
|
return flag, fmt.Errorf("flag already exists")
|
||||||
}
|
}
|
||||||
flag = models.PostFlag{
|
flag = models.PostFlag{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user