notify moderators now goes to the "community" user, that saves our poor mods from a flood of pms

if any staff respond to a pm they are automatically added to the list of recipients and will start
getting email notifications
This commit is contained in:
Sam
2013-09-06 14:07:23 +10:00
parent c495a0b996
commit 41a1b6942d
15 changed files with 635 additions and 583 deletions

View File

@ -21,6 +21,18 @@ describe Group do
end
end
def real_admins
Group[:admins].user_ids - [-1]
end
def real_moderators
Group[:moderators].user_ids - [-1]
end
def real_staff
Group[:staff].user_ids - [-1]
end
it "Can update moderator/staff/admin groups correctly" do
admin = Fabricate(:admin)
@ -28,33 +40,33 @@ describe Group do
Group.refresh_automatic_groups!(:admins, :staff, :moderators)
Group[:admins].user_ids.should == [admin.id]
Group[:moderators].user_ids.should == [moderator.id]
Group[:staff].user_ids.sort.should == [moderator.id,admin.id].sort
real_admins.should == [admin.id]
real_moderators.should == [moderator.id]
real_staff.sort.should == [moderator.id,admin.id].sort
admin.admin = false
admin.save
Group.refresh_automatic_group!(:admins)
Group[:admins].user_ids.should == []
real_admins.should == []
moderator.revoke_moderation!
admin.grant_admin!
Group[:admins].user_ids.should == [admin.id]
Group[:staff].user_ids.should == [admin.id]
real_admins.should == [admin.id]
real_staff.should == [admin.id]
admin.revoke_admin!
Group[:admins].user_ids.should == []
Group[:staff].user_ids.should == []
real_admins.should == []
real_staff.should == []
admin.grant_moderation!
Group[:moderators].user_ids.should == [admin.id]
Group[:staff].user_ids.should == [admin.id]
real_moderators.should == [admin.id]
real_staff.should == [admin.id]
admin.revoke_moderation!
Group[:admins].user_ids.should == []
Group[:staff].user_ids.should == []
real_admins.should == []
real_staff.should == []
end
it "Correctly updates automatic trust level groups" do
@ -87,12 +99,12 @@ describe Group do
groups.count.should == Group::AUTO_GROUPS.count
g = groups.find{|g| g.id == Group::AUTO_GROUPS[:admins]}
g.users.count.should == 1
g.user_count.should == 1
g.users.count.should == 2
g.user_count.should == 2
g = groups.find{|g| g.id == Group::AUTO_GROUPS[:staff]}
g.users.count.should == 1
g.user_count.should == 1
g.users.count.should == 2
g.user_count.should == 2
g = groups.find{|g| g.id == Group::AUTO_GROUPS[:trust_level_2]}
g.users.count.should == 1