From 62de1fc0fab4ce328632455ad91f91fabf87245f Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 17 Jun 2014 18:13:07 +1000 Subject: [PATCH] BUGFIX: use trust_level_0 cause it is less than 15 chars --- app/models/group.rb | 6 +++--- db/migrate/20140617080955_rename_registered_users.rb | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20140617080955_rename_registered_users.rb diff --git a/app/models/group.rb b/app/models/group.rb index 29864b0afda..5e53a4c35f8 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -17,7 +17,7 @@ class Group < ActiveRecord::Base :admins => 1, :moderators => 2, :staff => 3, - :registered_users => 10, + :trust_level_0 => 10, :trust_level_1 => 11, :trust_level_2 => 12, :trust_level_3 => 13, @@ -92,7 +92,7 @@ class Group < ActiveRecord::Base "SELECT u.id FROM users u WHERE u.moderator OR u.admin" when :trust_level_1, :trust_level_2, :trust_level_3, :trust_level_4, :trust_level_5 "SELECT u.id FROM users u WHERE u.trust_level >= #{id-10}" - when :registered_users + when :trust_level_0 "SELECT u.id FROM users u" end @@ -189,7 +189,7 @@ class Group < ActiveRecord::Base def self.desired_trust_level_groups(trust_level) trust_group_ids.keep_if do |id| - id == AUTO_GROUPS[:registered_users] || (trust_level + 10) >= id + id == AUTO_GROUPS[:trust_level_0] || (trust_level + 10) >= id end end diff --git a/db/migrate/20140617080955_rename_registered_users.rb b/db/migrate/20140617080955_rename_registered_users.rb new file mode 100644 index 00000000000..ec7e35b9e80 --- /dev/null +++ b/db/migrate/20140617080955_rename_registered_users.rb @@ -0,0 +1,5 @@ +class RenameRegisteredUsers < ActiveRecord::Migration + def change + execute "update groups set name = 'trust_level_0' where name = 'registered_users' and id = 10" + end +end