Respect Micropub post-status when creating articles

Articles created via Micropub were always published immediately,
ignoring the client-supplied post-status property. Clients like iA
Writer that publish drafts (post-status: draft) had no way to land
an article as unpublished.

EntryData now extracts post-status from the request, and
ArticleService sets published accordingly, defaulting to true when
the property is omitted or set to anything other than "draft".

Fixes #123

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AXyzNvQZPQgBoSZwW7cLG8
This commit is contained in:
Jonny Barnes 2026-08-22 17:16:55 +01:00
commit a76c84b40f
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
3 changed files with 37 additions and 1 deletions

View file

@ -24,6 +24,7 @@ class EntryData extends MicropubData
public readonly mixed $checkin,
public readonly mixed $syndication,
public readonly ?array $photos,
public readonly ?string $postStatus,
) {}
public static function fromRequest(Request $request): static
@ -49,6 +50,7 @@ class EntryData extends MicropubData
checkin: Arr::get($data, 'properties.checkin.0'),
syndication: Arr::get($data, 'properties.syndication.0'),
photos: Arr::get($data, 'properties.photo'),
postStatus: Arr::get($data, 'properties.post-status.0'),
);
}
@ -67,6 +69,7 @@ class EntryData extends MicropubData
checkin: $request->input('checkin'),
syndication: $request->input('syndication'),
photos: $request->input('photos'),
postStatus: $request->input('post-status'),
);
}
@ -100,6 +103,7 @@ class EntryData extends MicropubData
checkin: $data['checkin'] ?? null,
syndication: $data['syndication'] ?? null,
photos: $data['photos'] ?? null,
postStatus: $data['post-status'] ?? null,
);
}
@ -120,6 +124,7 @@ class EntryData extends MicropubData
'checkin' => $this->checkin,
'syndication' => $this->syndication,
'photos' => $this->photos,
'post-status' => $this->postStatus,
];
}
}