mx-space / mx-space/core

草稿首次发布不会触发订阅邮件通知

Open
#2,818 1 comment 0 reactions 0 assignees View on GitHub

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

复现步骤
  1. 创建一篇新文章草稿(我的场景是通过 CLI 创建)。
  2. 在管理后台打开草稿,将文章首次发布。
  3. 文章正常上线,但订阅读者没有收到新文章邮件。
代码排查线索

根据 v14.8.0 对应源码:

  • PublishService 先创建 isPublished: false 的文章,再通过 updateById 将其设为已发布。
  • 创建阶段的 post.create 仅发送到系统作用域。
  • 从未发布变为已发布时,PostService 发出 post.republish
  • SubscribeService 仅监听访客作用域的 post.createnote.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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.