publishing in edit

This commit is contained in:
Niko Abeler 2023-08-05 10:15:08 +02:00
parent 42d960f185
commit 70902af7e0
1 changed files with 3 additions and 1 deletions

View File

@ -127,8 +127,10 @@ func (h *EditorHandler) HandlePostEdit(c *fiber.Ctx) error {
published := c.FormValue("action") == "Publish"
if !published {
entry.SetPublishedAt(nil)
} else if entry.PublishedAt() == nil || entry.PublishedAt().IsZero() {
now := time.Now()
entry.SetPublishedAt(&now)
}
// update entry
entry.SetMetaData(meta)
err = h.entrySvc.Update(entry)