Locked post

This commit is contained in:
LittleSheep 2024-07-28 12:50:27 +08:00
parent 09bc86da02
commit 0c686d7f06
2 changed files with 8 additions and 0 deletions

View File

@ -123,6 +123,10 @@ func editArticle(c *fiber.Ctx) error {
return fiber.NewError(fiber.StatusNotFound, err.Error())
}
if item.LockedAt != nil {
return fiber.NewError(fiber.StatusForbidden, "post was locked")
}
if item.IsDraft && !data.IsDraft && data.PublishedAt == nil {
item.PublishedAt = lo.ToPtr(time.Now())
} else {

View File

@ -142,6 +142,10 @@ func editStory(c *fiber.Ctx) error {
return fiber.NewError(fiber.StatusNotFound, err.Error())
}
if item.LockedAt != nil {
return fiber.NewError(fiber.StatusForbidden, "post was locked")
}
if item.IsDraft && !data.IsDraft && data.PublishedAt == nil {
item.PublishedAt = lo.ToPtr(time.Now())
} else {