trypost/app
Matteo Martini a33ff5d00f
fix: keep post drafts unscheduled by default (#209)
* fix: keep post drafts unscheduled by default

* Align schedule validation and keep drafts unscheduled.

Require scheduled_at only when status is scheduled and the post has no
usable future schedule. Share that rule across web, API, and MCP, keep
create without a date as null, and preserve the legacy date → 09:00 UTC
fallback.

* Polish schedule validation typing and tests.

Type requiresExplicitSchedule status as ?string, reuse a local status
variable in request/tool validation, tighten the web reject assertion,
and collapse overlapping MCP unscheduled-create cases.

* Centralize status helper in post update validation.

Reuse the typed status() helper across FormRequests and the already-parsed
$status in UpdatePostTool so schedule checks stay consistent and less noisy.

* Share scheduled_at update rules across web, API, and MCP.

Centralize schedule validation in PostStatusRules, normalize status parsing
in one place, and align past-schedule coverage across entry points.

* Cover the full unscheduled-draft checklist in Pest.

Add feature coverage for null/past schedule rejection, explicit scheduling,
draft saves, publish-now without a schedule, calendar exclusion, and
09:00 UTC date defaults across web, API, and MCP.

* Remove normalizeStatus helper.

Keep the inline is_string check at the few call sites that read raw
request status before validation — no shared wrapper needed.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Drop is_string status guards from schedule validation.

Accept mixed status in PostStatusRules and rely on strict comparisons
with Rule::requiredIf / Rule::when — malformed input simply does not match.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Paulo Castellano <paulo@castellanos.llc>
2026-08-01 17:39:18 -03:00
..
Actions fix: keep post drafts unscheduled by default (#209) 2026-08-01 17:39:18 -03:00
Ai Merge main + finalize AI brand-colors toggle 2026-07-18 15:12:26 -03:00
Broadcasting feat(automations): implement automation features and UI enhancements 2026-05-24 09:17:19 -03:00
Concerns refactor: settings redesign, Spanish translations, language system, strict_types 2026-03-30 00:20:43 -03:00
Console/Commands Centralize the Meta long-lived token TTL and clarify the extension helper 2026-07-03 11:07:54 -03:00
DataTransferObjects Extract alt-text truncation onto MediaItem and close test gaps 2026-07-11 10:34:57 -03:00
Enums Allow account owners to delete workspaces (#208) 2026-08-01 13:00:38 -04:00
Events Defer PostCreated with DB::afterCommit in the observer. 2026-07-24 12:17:43 -03:00
Exceptions fix(x): harden chunked media upload handling and coverage 2026-07-24 10:30:34 -03:00
Helpers fix(security): make SSRF private-network block configurable and guard the last user-URL fetches 2026-07-17 15:40:15 -03:00
Http fix: keep post drafts unscheduled by default (#209) 2026-08-01 17:39:18 -03:00
Jobs Fire PostCreated on duplicate and drop unused PostHog eager load. 2026-07-24 11:56:44 -03:00
Listeners Capture post.created to PostHog with created_via. 2026-07-24 11:44:47 -03:00
Mail feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
Mcp fix: keep post drafts unscheduled by default (#209) 2026-08-01 17:39:18 -03:00
Models Allow account owners to delete workspaces (#208) 2026-08-01 13:00:38 -04:00
Observers Defer PostCreated with DB::afterCommit in the observer. 2026-07-24 12:17:43 -03:00
Policies Allow account owners to delete workspaces (#208) 2026-08-01 13:00:38 -04:00
Providers Clamp media byte caps to upload limits and surface truncated board lists. 2026-07-24 22:49:04 -03:00
Rules refactor(media): centralize image/video/document detection in Media\Type 2026-06-25 10:57:57 -03:00
Services Enforce carousel min slides in Generate and expose min_media_count on API/MCP. 2026-07-24 23:51:10 -03:00
Socialite feat(channels): add Discord as a social channel 2026-06-16 14:44:00 -03:00
Support fix: keep post drafts unscheduled by default (#209) 2026-08-01 17:39:18 -03:00