Topic notifications emails are not being sent if adding a Staff Colour to the post

Currently running Discourse 3.5.0.beta7-dev (7562bc2b15)

Topic notifications emails are not being sent out when scheduling a post to publish under certain conditions.

We’ve come across a very unusual bug and while we are running latest, this has occurred a few times in recent months so the issue has been around for a while.

We have a category called #Announcements and every user is set to Watching First Post by default.

Our steps to replicate the issue:

  1. Compose a new topic in a hidden staff-only category
  2. Apply a staff colour to the first post in the new topic
  3. Set a topic timer, Schedule Publishing, set the category to #Announcements and set the time/date

What should happen:

  • The topic moves from #staff to #Announcements
  • Tens of thousands of emails get sent
  • Each user receives a notification

What does happen:

  • The topic moves from #staff to #Announcements
  • No emails get sent
  • Each user receives a notification

While waiting for the scheduled publishing time to arrive, I could see these two tasks pending (filtered by the Post ID):

Ten minutes later when the topic was published in to the #Announcements the tasks disappeared:

The notifications were sent, here’s what a test account received:

But still no emails went out.

Usually at this point we’d see tens of thousands of emails starting to queue up in Scheduled and gradually moving their way across to Enqueued, but nothing happens, zero emails are sent out.

There is also nothing in Discourse error logs.

The posts contained a poll, but I suspect the post content is irrelevant, however I’m mentioning it here just in case the poll also has any relevance.

Today’s failed test can be found here if it helps anyone: https://greyarro.ws/t/do-you-own-a-drone-thats-not-on-the-what-do-you-fly-list/98146.json

The key to this failure very much seems to be caused by the action of adding a staff colour to the first post in the topic that’s scheduled for publishing.

Every other scheduled publishing post emails out just fine, adding a staff colour makes it fail every single time.