From 0134bfb0c6c909ef97afead05a8508abe97c9bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=20Lyovs=C3=B3n?= Date: Fri, 20 Nov 2026 01:42:58 +0400 Subject: [PATCH] fix(posts): require an author to publish MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Post 16 (Siri + Gemini) lost its authors and topics in a burst of saves on 2026-01-22 and stayed published for ten months with the JSON-LD author falling back to "Lyóvson Team". Payload now rejects publishing a post without an author; drafts may still leave it empty. Authors are a hasMany relationship stored in posts_rels, so no migration is needed. Co-Authored-By: Claude Opus 5.5 --- src/collections/Posts/index.ts | 3 +++ src/payload-types.ts | 2 +- src/utilities/syndication-feed.test.ts | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/collections/Posts/index.ts b/src/collections/Posts/index.ts index 660cebfe..2de5ae81 100644 --- a/src/collections/Posts/index.ts +++ b/src/collections/Posts/index.ts @@ -194,6 +194,9 @@ export const Posts: CollectionConfig = { }, hasMany: true, relationTo: "lyovsons", + // Drafts may leave it empty; publishing needs an author (a post lost + // its authors in Jan 2026 and stayed published without one). + required: true, }, // This field is only used to populate the user data via the `populateAuthors` hook // This is because the `user` collection has access control locked to protect user privacy diff --git a/src/payload-types.ts b/src/payload-types.ts index 4c891c96..0a36334e 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -301,7 +301,7 @@ export interface Post { /** * Who authored this post */ - authors?: (number | Lyovson)[] | null; + authors: (number | Lyovson)[]; populatedAuthors?: | { id?: string | null; diff --git a/src/utilities/syndication-feed.test.ts b/src/utilities/syndication-feed.test.ts index 0c70b8c6..d3deca7e 100644 --- a/src/utilities/syndication-feed.test.ts +++ b/src/utilities/syndication-feed.test.ts @@ -23,6 +23,7 @@ const post: Post = { publishedAt, createdAt: publishedAt, updatedAt: publishedAt, + authors: [1], populatedAuthors: [{ id: "1", name: "Rafa Lyóvson", username: "rafa" }], project: { _status: "published",