FIX: add email reply error message for topic not getting created in restricted category

This commit is contained in:
Arpit Jalan
2015-04-10 14:59:45 +05:30
parent 75890aed26
commit e6df97f01d
4 changed files with 45 additions and 0 deletions

View File

@ -562,6 +562,25 @@ greatest show ever created. Everyone should watch it.
expect(e.message).to include("too short")
end
it "blocks user in restricted group from creating topic" do
to = "some@email.com"
restricted_user = Fabricate(:user, trust_level: 4)
restricted_group = Fabricate(:group)
restricted_group.add(restricted_user)
restricted_group.save
category = Fabricate(:category, email_in_allow_strangers: false, email_in: to)
category.set_permissions(restricted_group => :readonly)
category.save
expect{
process_email(from: restricted_user.email, to: to)
}.to raise_error(Discourse::InvalidAccess)
end
end