FIX: Group owners should be able to invite users to their groups.

https://meta.discourse.org/t/group-owner-cannot-send-an-invite-to-a-group/60617/12
This commit is contained in:
Guo Xiang Tan
2017-07-21 15:12:24 +09:00
parent fe05587134
commit 2a17f1ccd7
18 changed files with 256 additions and 114 deletions

View File

@ -12,46 +12,6 @@ describe Admin::GroupsController do
expect(Admin::GroupsController < Admin::AdminController).to eq(true)
end
context ".index" do
it "produces valid json for groups" do
group = Fabricate.build(:group, name: "test")
group.add(@admin)
group.save
xhr :get, :index
expect(response.status).to eq(200)
json = ::JSON.parse(response.body)
expect(json.select { |r| r["id"] == Group::AUTO_GROUPS[:everyone] }).to be_empty
expect(json.select { |r| r["id"] == group.id }).to eq([{
"id"=>group.id,
"name"=>group.name,
"user_count"=>1,
"automatic"=>false,
"alias_level"=>0,
"visibility_level"=>0,
"automatic_membership_email_domains"=>nil,
"automatic_membership_retroactive"=>false,
"title"=>nil,
"primary_group"=>false,
"grant_trust_level"=>nil,
"incoming_email"=>nil,
"has_messages"=>false,
"flair_url"=>nil,
"flair_bg_color"=>nil,
"flair_color"=>nil,
"bio_raw"=>nil,
"bio_cooked"=>nil,
"public"=>false,
"allow_membership_requests"=>false,
"full_name"=>group.full_name,
"default_notification_level"=>3
}])
end
end
context ".bulk" do
it "can assign users to a group by email or username" do
group = Fabricate(:group, name: "test", primary_group: true, title: 'WAT', grant_trust_level: 3)