✨ Locked post
This commit is contained in:
parent
09bc86da02
commit
0c686d7f06
@ -123,6 +123,10 @@ func editArticle(c *fiber.Ctx) error {
|
|||||||
return fiber.NewError(fiber.StatusNotFound, err.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 {
|
if item.IsDraft && !data.IsDraft && data.PublishedAt == nil {
|
||||||
item.PublishedAt = lo.ToPtr(time.Now())
|
item.PublishedAt = lo.ToPtr(time.Now())
|
||||||
} else {
|
} else {
|
||||||
|
@ -142,6 +142,10 @@ func editStory(c *fiber.Ctx) error {
|
|||||||
return fiber.NewError(fiber.StatusNotFound, err.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 {
|
if item.IsDraft && !data.IsDraft && data.PublishedAt == nil {
|
||||||
item.PublishedAt = lo.ToPtr(time.Now())
|
item.PublishedAt = lo.ToPtr(time.Now())
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user