Skip to content

feat: improve article creation UX and fix archived note access#237

Merged
Rabithua merged 2 commits into
developfrom
crawling-popcorn
Apr 13, 2026
Merged

feat: improve article creation UX and fix archived note access#237
Rabithua merged 2 commits into
developfrom
crawling-popcorn

Conversation

@Rabithua

Copy link
Copy Markdown
Owner

Summary

  • Auto-link article when creating from note editor - eliminates manual steps after article creation
  • Fix 404 error when accessing articles linked by archived public notes
  • Use replace navigation to prevent returning to empty create page

Changes

  1. Auto-link article flow: When creating an article from the note editor, it automatically returns and links the new article
  2. Archived note fix: Articles linked by archived public notes are now accessible (previously returned 404)

Test plan

  • Create a note, click "link article", create new article, verify it auto-links after save
  • Archive a public note with linked article, verify the article is still accessible
  • Edit an existing article, verify navigation works correctly

🤖 Generated with Claude Code

When creating an article from the note editor, the article is now
automatically linked to the note after saving, improving the UX by
eliminating manual steps. Also uses replace navigation to prevent
returning to empty create page.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Rabithua Rabithua changed the base branch from main to develop April 13, 2026 08:45
Previously, getNoteByArticleId filtered out archived notes, causing
404 errors when accessing articles linked by archived public notes.
Now archived status is not filtered, so public notes' articles remain
accessible even after archiving.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Rabithua Rabithua merged commit fc1434c into develop Apr 13, 2026
2 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce4f34b34c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// 查找 articleId 匹配的笔记(不过滤归档状态,归档的公开笔记仍可访问其文章)
const note = await db.query.rotes.findFirst({
where: (rotes, { eq, and }) => and(eq(rotes.articleId, articleId), eq(rotes.archived, false)),
where: (rotes, { eq }) => eq(rotes.articleId, articleId),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict article-note lookup to public candidates

getNoteByArticleId now picks the first note with a matching articleId without filtering by visibility, but both article read endpoints authorize non-authors from that single returned note (note.state === 'public'). Because the DB schema does not enforce one-note-per-article, an article linked to both a public note and a private archived note can now be denied intermittently if the private row is returned first, which regresses public article availability after this change. Prefer filtering/ordering this lookup for permission checks so public references are selected deterministically.

Useful? React with 👍 / 👎.

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