diff --git a/pkg/internal/server/api/articles_api.go b/pkg/internal/server/api/articles_api.go index cc236f1..4990ede 100644 --- a/pkg/internal/server/api/articles_api.go +++ b/pkg/internal/server/api/articles_api.go @@ -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 { diff --git a/pkg/internal/server/api/stories_api.go b/pkg/internal/server/api/stories_api.go index 9ab4c2b..abb165c 100644 --- a/pkg/internal/server/api/stories_api.go +++ b/pkg/internal/server/api/stories_api.go @@ -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 {