New edited at property to prevent post background update shows as edited

This commit is contained in:
LittleSheep 2024-07-27 23:10:07 +08:00
parent 2366c3fd42
commit 16d1790fb1
2 changed files with 3 additions and 0 deletions

View File

@ -28,6 +28,7 @@ type Post struct {
RepostTo *Post `json:"repost_to" gorm:"foreignKey:RepostID"`
Realm *Realm `json:"realm"`
EditedAt *time.Time `json:"edited_at"`
PinnedAt *time.Time `json:"pinned_at"`
IsDraft bool `json:"is_draft"`

View File

@ -226,6 +226,8 @@ func NewPost(user models.Account, item models.Post) (models.Post, error) {
}
}
item.EditedAt = lo.ToPtr(time.Now())
if err := database.C.Save(&item).Error; err != nil {
return item, err
}