FIX: everyone is not a visible group
This commit is contained in:
parent
f083994f5a
commit
9a94d1b212
|
@ -1,7 +1,7 @@
|
||||||
class Admin::GroupsController < Admin::AdminController
|
class Admin::GroupsController < Admin::AdminController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
groups = Group.order(:name)
|
groups = Group.order(:name).where("name <> 'everyone'")
|
||||||
|
|
||||||
if search = params[:search]
|
if search = params[:search]
|
||||||
search = search.to_s
|
search = search.to_s
|
||||||
|
|
|
@ -160,6 +160,7 @@ class Group < ActiveRecord::Base
|
||||||
# the everyone group is special, it can include non-users so there is no
|
# the everyone group is special, it can include non-users so there is no
|
||||||
# way to have the membership in a table
|
# way to have the membership in a table
|
||||||
if name == :everyone
|
if name == :everyone
|
||||||
|
group.visible = false
|
||||||
group.save!
|
group.save!
|
||||||
return group
|
return group
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,3 +2,4 @@ Group.ensure_automatic_groups!
|
||||||
if g = Group.find_by(name: 'trust_level_5', id: 15)
|
if g = Group.find_by(name: 'trust_level_5', id: 15)
|
||||||
g.destroy!
|
g.destroy!
|
||||||
end
|
end
|
||||||
|
Group.where(name: 'everyone').update_all(visible: false)
|
||||||
|
|
|
@ -154,6 +154,11 @@ describe Group do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "makes sure the everyone group is not visible" do
|
||||||
|
g = Group.refresh_automatic_group!(:everyone)
|
||||||
|
expect(g.visible).to eq(false)
|
||||||
|
end
|
||||||
|
|
||||||
it "Correctly handles removal of primary group" do
|
it "Correctly handles removal of primary group" do
|
||||||
group = Fabricate(:group)
|
group = Fabricate(:group)
|
||||||
user = Fabricate(:user)
|
user = Fabricate(:user)
|
||||||
|
|
Loading…
Reference in New Issue