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:
Osama Sayegh
2018-08-23 07:36:49 +03:00
committed by Sam
parent b2ce33be26
commit 2711f173dc
10 changed files with 133 additions and 2 deletions

View File

@@ -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)