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
|
||||
|
||||
def index
|
||||
groups = Group.order(:name)
|
||||
groups = Group.order(:name).where("name <> 'everyone'")
|
||||
|
||||
if search = params[:search]
|
||||
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
|
||||
# way to have the membership in a table
|
||||
if name == :everyone
|
||||
group.visible = false
|
||||
group.save!
|
||||
return group
|
||||
end
|
||||
|
|
|
@ -2,3 +2,4 @@ Group.ensure_automatic_groups!
|
|||
if g = Group.find_by(name: 'trust_level_5', id: 15)
|
||||
g.destroy!
|
||||
end
|
||||
Group.where(name: 'everyone').update_all(visible: false)
|
||||
|
|
|
@ -154,6 +154,11 @@ describe Group do
|
|||
|
||||
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
|
||||
group = Fabricate(:group)
|
||||
user = Fabricate(:user)
|
||||
|
|
Loading…
Reference in New Issue