I’ve just done some implementation work on this, but it’s not done and I don’t have the time to finish it right now.
If someone else could polish this off, that would be nice.
The conditions for a PM to be “boring” are:
- Messages from the site contact user are only boring to the sender until there’s a reply
- Flag -> notify moderators is always boring unless there’s a non-auto-inserted reply
- Flag -> notify user is only boring to the sender until there’s a reply
The implementation needs to change - we can’t have this monster SQL firing off all the time.
Proposed implementation: A column on the topic holding the ‘boringness’.
0 - not boring to anyone, 1 - boring to topic creator, 2 - boring to all participants.
When a topic is created, the boringness is 0 unless specified otherwise in the PostCreator options.
Whenever a reply is made to a topic, unless the reply is an auto-inserted reply from resolving a Notify Moderators flag, the boringness is set to 0.
Messages from the site contact user, and Flag -> Notify User are boring 1.
Flag -> Notify Moderators are boring 2.
We can adapt the queries present in this WIP version of the patch to backfill the boringness for all topics in a migration.
Then, the list queries would just be
.where("topics.boringness = 0 OR (topics.boringness = 1 AND topics.user_id = :user_id)") and
.where("topics.boringness = 2 OR (topics.boringness = 1 AND topics.user_id <> :user_id)").