Would love to see more granular control of the beta feature “Who can use private messages.” For my particular use case, I would like Admins/Members to be able to PM anyone and Guests can PM only Admins/Members but not other guests. Like illustrated below.
X Admins to
X Members to
X Guests to
Currently this is my rough hack of actions.py to facilitate the my use case.
def check_private_message_policy(realm: Realm, sender: UserProfile,
user_profiles: Sequence[UserProfile]) -> None:
if realm.private_message_policy == Realm.PRIVATE_MESSAGE_POLICY_DISABLED:
if sender.is_bot or (len(user_profiles) == 1 and user_profiles.is_bot):
# We allow PMs only between users and bots, to avoid
# breaking the tutorial as well as automated
# notifications from system bots to users.
raise JsonableError((“Private messages are disabled in this organization.”))
if sender.is_guest and (len(user_profiles) == 1 and user_profiles.is_guest):
raise JsonableError((“Guest to guest private messages are disabled in this organization.”))
In addition, some sort of notification to the user that they have been blocked would be great