FIX: Allow invites if must_approve_users is true (#15043)
This was implemented in36e0e6a
, but then regressed when the guardian for invites was refactored in76a7b75
.
This commit is contained in:
parent
5a8e6de42c
commit
f43c433d50
|
@ -362,7 +362,6 @@ class Guardian
|
|||
|
||||
def can_invite_to_forum?(groups = nil)
|
||||
authenticated? &&
|
||||
(is_staff? || !SiteSetting.must_approve_users?) &&
|
||||
(is_staff? || SiteSetting.max_invites_per_day.to_i.positive?) &&
|
||||
(is_staff? || @user.has_trust_level?(SiteSetting.min_trust_level_to_allow_invite.to_i)) &&
|
||||
(is_admin? || groups.blank? || groups.all? { |g| can_edit_group?(g) })
|
||||
|
|
|
@ -492,9 +492,9 @@ describe Guardian do
|
|||
expect(Guardian.new.can_invite_to_forum?).to be_falsey
|
||||
end
|
||||
|
||||
it 'returns true when the site requires approving users and is mod' do
|
||||
it 'returns true when the site requires approving users' do
|
||||
SiteSetting.must_approve_users = true
|
||||
expect(Guardian.new(moderator).can_invite_to_forum?).to be_truthy
|
||||
expect(Guardian.new(trust_level_2).can_invite_to_forum?).to be_truthy
|
||||
end
|
||||
|
||||
it 'returns false when max_invites_per_day is 0' do
|
||||
|
|
Loading…
Reference in New Issue