Changeset 11b3ba5 in Klonkt for src/routes


Ignore:
Timestamp:
06/21/2026 03:54:13 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
1664f31
Parents:
5e61b17
Message:

fix(editor): schedule publication behind an on/off toggle (no accidental date)

The "Publish on" date field was always open → an accidentally chosen date silently
set the post to 'scheduled' (not live, no obvious reason). Now a "Schedule
publication" toggle, off by default = publish immediately; the date field appears
and counts only when the toggle is on (input disabled when off). Server honours
publish_at only with schedule_enabled (bulletproof, create + update). NL/EN/DE.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/posts.js

    r5e61b17 r11b3ba5  
    186186  let publishAt = null;
    187187  const pa = Date.parse(req.body.publish_at || '');
    188   if (finalStatus === 'published' && Number.isFinite(pa) && pa > Date.now()) {
     188  if (req.body.schedule_enabled && finalStatus === 'published' && Number.isFinite(pa) && pa > Date.now()) {
    189189    finalStatus = 'scheduled';
    190190    publishAt = new Date(pa).toISOString();
     
    297297  let publishAt = null;
    298298  const pa = Date.parse(req.body.publish_at || '');
    299   if (finalStatus === 'published' && Number.isFinite(pa) && pa > Date.now()) {
     299  if (req.body.schedule_enabled && finalStatus === 'published' && Number.isFinite(pa) && pa > Date.now()) {
    300300    finalStatus = 'scheduled';
    301301    publishAt = new Date(pa).toISOString();
Note: See TracChangeset for help on using the changeset viewer.