Allow sending Private Messages to Staff

Figured out what was wrong :partying_face:

I didn’t customise/configure the Travis testing, so it seems to have prevented the plugin from working.

So I tried removing everything except the plugin.rb file and it started working for me. I modified the logic slightly for my use case also.

As it is currently, TL0+ can message an admin if their trust level falls below the ‘min trust to send messages’ configured, but they cannot message a moderator.

So to modify this, this section needs to be changed very slightly (appreciate the clear comments :slight_smile: ):

# Have to be a basic level at least -- and now: OR SENDING TO ADMIN
(is_group || @user.has_trust_level?(SiteSetting.min_trust_to_send_messages) || notify_moderators || target.admin) &&

If you want to allow messaging to any staff member (who has not specifically disabled receiving personal messages), then change it to:

# Have to be a basic level at least -- and now: OR SENDING TO STAFF
(is_group || @user.has_trust_level?(SiteSetting.min_trust_to_send_messages) || notify_moderators || target.staff?) &&

If you want to enable messaging to mods only and not admins:

# Have to be a basic level at least -- and now: OR SENDING TO MODERATOR
(is_group || @user.has_trust_level?(SiteSetting.min_trust_to_send_messages) || notify_moderators || target.moderator) &&

Thanks again @pfaffman and @angus!
:100:

2 Likes