Automated Responses to Flags not Generating Notification

On WTDWTF, we’ve been getting reports that users are not being notified when a staff members agrees, disagrees, or defers their custom flags. The automated post is being added to the message that’s attached to the flag, but the user isn’t being notified of this. They don’t find out about the new post unless they visit the Messages page in their profile.

If a staff member manually replies in the message attached to the flag, the notification does get properly generated.

Because of another bug that causes the automatic post to not generate if the flag was created by a staff member, this bug requires a non-staff account to reproduce.

5 Likes

This part is not a bug, any response in the topic by a staff member, including creation of the first post, prevents automated reply.

2 Likes

I narrowed this down to a timing issue in Jobs::PostAlert. If I throw a sleep in there and query for the automated response post, it works fine. Otherwise, the first query fails to find the post.

Jobs are working fine for other posts that are enqueued though.

3 Likes

my first encounter of a race condition… :bomb:

https://github.com/discourse/discourse/pull/3854

2 Likes

PR merged :smile: Please flag if the patch didn’t fix it for you