草稿首次发布不会触发订阅邮件通知
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 558
- Forks
- 156
- Avg merge
- 10h 57m
- Merged PRs (30d)
- 5
Description
Describe the bug
环境
Core v14.8.0
复现步骤
- 创建一篇新文章草稿(我的场景是通过 CLI 创建)。
- 在管理后台打开草稿,将文章首次发布。
- 文章正常上线,但订阅读者没有收到新文章邮件。
代码排查线索
根据 v14.8.0 对应源码:
- PublishService 先创建
isPublished: false的文章,再通过updateById将其设为已发布。 - 创建阶段的
post.create仅发送到系统作用域。 - 从未发布变为已发布时,PostService 发出
post.republish。 - SubscribeService 仅监听访客作用域的
post.create和note.create,没有监听post.republish。
因此,草稿首次发布似乎没有触发订阅邮件处理器。
直接监听所有 post.republish 可能会让撤回后重新发布的旧文章重复发送邮件,希望能区分首次发布与再次发布。
Reproduction
利用 AI 通过 CLI 创建一篇草稿文章,在管理后台人工审核修改后进行发布,订阅读者不会收到邮件。
System Info
Core: @mx-space/core 14.8.0
Admin: Core 14.8.0 自带版本
部署方式: Docker,innei/mx-server:latest
API Base: /api/v3
Node.js: 26.7.0
pnpm: 11.25.0
API 根接口返回:
name: @mx-space/core
version: 14.8.0
https://xxu.do/v3
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- The provided reproduction is a minimal reproducible of the bug.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the PublishService flow from draft creation through updateById, then inspect the post.republish event in PostService and the event listeners in SubscribeService. Check how the system distinguishes first publication from republishing an older post. Done means a draft’s first publication sends subscription email notifications without resending them for a later republish.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100