mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 19:44:39 +08:00
FEATURE: Show error if invite to topic is invalid (#15959)
This can happen if the topic to which a user is invited is in a private category and the user was not invited to one of the groups that can see that specific category. This used to be a warning and this commit makes it an error.
This commit is contained in:
@ -429,27 +429,4 @@ describe Invite do
|
||||
expect(invite.invalidated_at).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
describe '#warnings' do
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
fab!(:invite) { Fabricate(:invite) }
|
||||
fab!(:group) { Fabricate(:group) }
|
||||
fab!(:secured_category) do
|
||||
secured_category = Fabricate(:category)
|
||||
secured_category.permissions = { group.name => :full }
|
||||
secured_category.save!
|
||||
secured_category
|
||||
end
|
||||
|
||||
it 'does not return any warnings for simple invites' do
|
||||
expect(invite.warnings(admin.guardian)).to be_blank
|
||||
end
|
||||
|
||||
it 'returns a warning if topic is private' do
|
||||
topic = Fabricate(:topic, category: secured_category)
|
||||
TopicInvite.create!(topic: topic, invite: invite)
|
||||
|
||||
expect(invite.warnings(admin.guardian)).to contain_exactly(I18n.t("invite.requires_groups", groups: group.name))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user