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
19 lines
363 B
PHP
19 lines
363 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Models\Article;
|
|
|
|
class ArticleService
|
|
{
|
|
public function create(array $data): Article
|
|
{
|
|
return Article::create([
|
|
'title' => $data['name'],
|
|
'main' => $data['content'],
|
|
'published' => ($data['post-status'] ?? null) !== 'draft',
|
|
]);
|
|
}
|
|
}
|