mirror of
https://github.com/svemagie/obsidian-micropub.git
synced 2026-05-14 19:38:50 +02:00
fix: default post-status to draft; honor explicit published flag
- buildProperties() now sends post-status: draft by default when the frontmatter field is absent, so posts are never accidentally published - Only post-status: published explicitly triggers a live publish - writeUrlToNote() stamps post-status: published back only when the original note was already set to published - Consolidate duplicate parseFrontmatter() call in writeUrlToNote() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+8
-2
@@ -218,6 +218,8 @@ export class Publisher {
|
||||
props["visibility"] = [visibility];
|
||||
}
|
||||
|
||||
props["post-status"] = [(fm["post-status"] as string | undefined) ?? "draft"];
|
||||
|
||||
// AI disclosure — kebab-case keys (ai-text-level, ai-tools, etc.)
|
||||
// with camelCase fallback for backward compatibility.
|
||||
// Also support nested `ai` object flattening.
|
||||
@@ -415,11 +417,16 @@ export class Publisher {
|
||||
":" +
|
||||
String(now.getSeconds()).padStart(2, "0");
|
||||
|
||||
const { frontmatter: fm } = this.parseFrontmatter(originalContent);
|
||||
const wasDraft = fm["post-status"] !== "published";
|
||||
|
||||
const fields: Array<[string, string]> = [
|
||||
["mp-url", `"${url}"`],
|
||||
["post-status", "published"],
|
||||
["published", publishedDate],
|
||||
];
|
||||
if (!wasDraft) {
|
||||
fields.push(["post-status", "published"]);
|
||||
}
|
||||
|
||||
// Record the syndication targets used so future publishes know what was sent
|
||||
if (syndicateToOverride !== undefined) {
|
||||
@@ -437,7 +444,6 @@ export class Publisher {
|
||||
|
||||
// Stamp evergreen-since on first promotion to the evergreen garden stage.
|
||||
{
|
||||
const { frontmatter: fm } = this.parseFrontmatter(originalContent);
|
||||
if (!fm["evergreen-since"]) {
|
||||
const rawTags = [
|
||||
...this.resolveArray(fm["tags"]),
|
||||
|
||||
Reference in New Issue
Block a user