mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: don't allow inviting more than max_allowed_message_recipients
* FIX: don't allow inviting more than `max_allowed_message_recipients` setting allows * add specs for guardian * user preferences for auto track shouldn't be applicable to PMs (it auto watches on visit) Execlude PMs from "Automatically track topics I enter..." and "When I post in a topic, set that topic to..." user preferences * groups take only 1 slot in PM * just return if topic is a PM
This commit is contained in:
@@ -801,6 +801,11 @@ class Topic < ActiveRecord::Base
|
||||
false
|
||||
end
|
||||
|
||||
def reached_recipients_limit?
|
||||
return false unless private_message?
|
||||
topic_allowed_users.count + topic_allowed_groups.count >= SiteSetting.max_allowed_message_recipients
|
||||
end
|
||||
|
||||
def invite_group(user, group)
|
||||
TopicAllowedGroup.create!(topic_id: id, group_id: group.id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user