即使话题已转为私信,仍向分类关注者发送邮件

大家好,

我们论坛刚刚遇到一个情况:有用户在某个被其他用户关注的分类下发布了帖子。但由于该用户提问的性质,帖子在3分钟内被一名版主转换为私信。

尽管帖子已转换为私信,但它似乎仍然触发了向关注原分类的用户发送邮件,这在我看来似乎不太合理。我原本预期,既然帖子已转换为私人/个人消息,就不会发送邮件。

1 个赞

oh my - if that’s happening then it’s a serious bug. are you able to replicate it? e.g.

  • create test accounts A and B
  • log in with account A and watch a category
  • log in with account B and create a topic in that category
  • receive email notification in account A
  • move topic into personal message
  • add reply as account B
  • receive email notification in account A

澄清一下:

  • 用户 A 关注了该分类
  • 用户 B 在同一分类中发起一个新话题
  • 管理员在很短的时间内(例如 < 5 分钟)将 B 的帖子转换为仅涉及 B 和管理员之间的私信
  • 用户 A 仍在帖子创建后 x 分钟收到通知新帖子的电子邮件

我使用两个测试账户成功复现了该问题。电子邮件仍会发送给用户 A(但如果他们点击进入,则无法查看完整消息)。

我并非 Discourse 专家,但据我所见,该话题会触发 Sidekiq 中的计划任务,并在话题创建后 x 分钟发送。

1 个赞

To be clear, this is just the first post that was emailed, not the following private messages correct?

If that is the case I don’t see how you could prevent that to be honest, the email would have gone by the time someone converted it.

1 个赞

That’s correct - thankfully! :slight_smile:

At the point of being converted to a PM, the email is still sat in Sidekiq. I’m not going to say I’m a Discourse expert, or even say I understand how it works (because I don’t - I just love its format and a member of several Discourse powered sites), so I’m not sure if it could be prevented.

Perhaps a timeline of events could help explain the situation:

  • 5:20pm - User A posts publicly
  • 5:21pm - Mod converts post to a PM
  • 5:30pm - User B receives the “New post” email, with a subject of [Site Site][PM] New Topic

Just after the post was converted, there was a Jobs::UserEmail event in Sidekiq for the new topic.

Only speaking for myself (hosted by Discourse), it seems like my emails land pretty much immediately after a post. I have mailing list mode turned on, send me mail even if I’m on the site, that sort of thing. You might be able to call it back if it hadn’t been sent, but that seems like a race. In this case it was close, but if it had happened after the mod had logged off it likely would have sat there much longer.

There is a window – I think it’s 30 seconds. @jomaxro can confirm.

1 个赞

The defaults (configurable via site settings) are 20 seconds after posting for personal message notifications, and 10 minutes for all other notifications. The relevant site settings are personal email time window seconds and email time window mins.

6 个赞