Skip to content

Only show draft banner for genuinely unpublished memos#39

Merged
xrendan merged 1 commit into
mainfrom
fix/draft-banner-published-memos
Jul 23, 2026
Merged

Only show draft banner for genuinely unpublished memos#39
xrendan merged 1 commit into
mainfrom
fix/draft-banner-published-memos

Conversation

@xrendan

@xrendan xrendan commented Jul 23, 2026

Copy link
Copy Markdown
Member

Summary

The DRAFT preview banner on memo pages was gated solely on the viewer being a logged-in admin (accessToken), with no reference to the memo's publish status. As a result, every memo — including published ones — showed the orange "DRAFT — not yet published" bar to any admin.

This gates the banner on the memo's actual publish state. A memo is treated as a draft only when it has no publishedAt, or one scheduled in the future:

const isDraft = !memo.publishedAt || new Date(memo.publishedAt) > new Date();
// ...
{accessToken && isDraft && <DraftPreviewBanner state="viewing-draft" slug={slug} />}

Published memos no longer show the preview banner to admins; genuine drafts (and scheduled-but-not-yet-live memos) still do.

Testing

  • As an admin, view a published memo → no draft banner.
  • As an admin, view an unpublished/scheduled memo → draft banner still appears.
  • As a non-admin → unchanged (no token, banner never rendered).

The DRAFT preview banner was gated solely on the viewer being a
logged-in admin, so every memo — including published ones — showed the
orange "DRAFT — not yet published" bar to admins. Gate it on the memo's
actual publish state instead: a memo is a draft only when it has no
publishedAt, or one scheduled in the future.
@xrendan
xrendan merged commit 34dfa8e into main Jul 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant