FIX: allow sending PMs to staff via flag even when PMs are disabled (#6938)

* FIX: allow sending PMs to staff via flag even when PMs are disabled
FIX: allow sending PMs to staff via flag even if the user trust level is insufficient

* Update lib/topic_creator.rb

Co-Authored-By: techAPJ <arpit@techapj.com>
This commit is contained in:
Arpit Jalan
2019-01-24 16:56:59 +05:30
committed by GitHub
parent cba6bdaf52
commit fabeba788d
5 changed files with 15 additions and 8 deletions

View File

@@ -260,7 +260,10 @@ class TopicCreator
end
def check_can_send_permission!(topic, obj)
rollback_with!(topic, :cant_send_pm) unless @opts[:skip_validations] || @guardian.can_send_private_message?(obj)
unless @opts[:skip_validations] ||
@guardian.can_send_private_message?(obj, notify_moderators: topic&.subtype == TopicSubtype.notify_moderators))
rollback_with!(topic, :cant_send_pm)
end
end
def find_or_create_user(email, display_name)