I have the initial implementation up @
https://github.com/discourse/discourse/pull/5226
However, I’m still quite uncertain what we should do about existing PMs with the user in it. Here is what I think should happen for the following scenarios when User A disables private messages:
PM between User A and User B
User B will not be able to create new replies in the PM
PM between User A and Non staff group
User B and members in Non staff group will not be able to create new replies in the PM
As long as a staff group or user is in the PM
No restrictions on new replies
When I was looking through the code path, I realized that the muted users features have this same problem as well. We only prevent muted users from creating new PMs to the target user but the muted user is still free to add replies to existing PMs.
While I discussed this @sam internally, I’m actually leaning towards adding a feature that allows a user to leave a PM instead. That will allow existing PMs to carry on as per normal without having to handle the above scenarios and add overhead to our PostCreator class.