Skip to content

fix(xiaohongshu): attach real topics via inline "#" dropdown#1779

Open
E2ern1ty wants to merge 1 commit into
jackwener:mainfrom
E2ern1ty:fix-xhs-publish-topics
Open

fix(xiaohongshu): attach real topics via inline "#" dropdown#1779
E2ern1ty wants to merge 1 commit into
jackwener:mainfrom
E2ern1ty:fix-xhs-publish-topics

Conversation

@E2ern1ty
Copy link
Copy Markdown
Contributor

Description

The publish --topics flow relied on a standalone "添加话题" button plus a dedicated topic search <input> that the current creator-center editor no longer exposes. As a result each topic only inserted a bare # into the body with no linked topic entity, leaving notes ending in stray ####....

Drive the editor's native inline flow instead: focus the body editor, type #<topic> to trigger the suggestion dropdown, then select the suggestion that best matches the topic (falling back to the first item, then to Enter). Topic failures stay non-fatal so the note still publishes.

Also hoist the body-editor selectors into a shared BODY_SELECTORS constant reused by both the content fill and topic steps.

Adds a unit test covering the inline dropdown selection path.

Related issue: N/A

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🌐 New site adapter
  • 📝 Documentation
  • ♻️ Refactor
  • 🔧 CI / build / tooling

Checklist

  • I ran the checks relevant to this PR
  • I updated tests or docs if needed
  • I included output or screenshots when useful

Documentation (if adding/modifying an adapter)

  • Added doc page under docs/adapters/ (if new adapter)
  • Updated docs/adapters/index.md table (if new adapter)
  • Updated sidebar in docs/.vitepress/config.mts (if new adapter)
  • Updated README.md / README.zh-CN.md when command discoverability changed
  • Used positional args for the command's primary subject unless a named flag is clearly better
  • Normalized expected adapter failures to CliError subclasses instead of raw Error

Screenshots / Output

Before: notes published with --topics A,B,C ended in stray ####### with zero linked topics.
After: the same command attaches real topic entities; the note body ends cleanly with the selected topics.

Test:

vitest run --project adapter clis/xiaohongshu/publish.test.js
# Test Files  1 passed (1)
#      Tests  13 passed (13)

The publish `--topics` flow relied on a standalone "添加话题" button plus a
dedicated topic search `<input>` that the current creator-center editor no
longer exposes. As a result each topic only inserted a bare `#` into the body
with no linked topic entity, leaving notes ending in stray `####...`.

Drive the editor's native inline flow instead: focus the body editor, type
`#<topic>` to trigger the suggestion dropdown, then select the suggestion that
best matches the topic (falling back to the first item, then to Enter). Topic
failures stay non-fatal so the note still publishes.

Also hoist the body-editor selectors into a shared `BODY_SELECTORS` constant
reused by both the content fill and topic steps.

Adds a unit test covering the inline dropdown selection path.
@E2ern1ty
Copy link
Copy Markdown
Contributor Author

@jackwener Hi, could you help take a look at this PR when you have a moment? It fixes the xiaohongshu publish --topics flow, which currently leaves stray # characters with no linked topics because the creator-center editor changed its topic UI. Tests pass (98 xiaohongshu adapter tests + 2156 adapter tests total). Thanks!

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