diff --git a/app/models/category.rb b/app/models/category.rb index bdeacedb57d..ecae7bb8af4 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -34,9 +34,9 @@ class Category < ActiveRecord::Base scope :secured, ->(guardian = nil) { ids = guardian.secure_category_ids if guardian if ids.present? - where("categories.secure ='f' or categories.id in (:cats)", cats: ids) + where("NOT categories.secure or categories.id in (:cats)", cats: ids) else - where("categories.secure ='f'") + where("NOT categories.secure") end } diff --git a/app/models/group.rb b/app/models/group.rb index 9265be647f7..7d94e4736c9 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -38,11 +38,11 @@ class Group < ActiveRecord::Base real_ids = case name when :admins - "SELECT u.id FROM users u WHERE u.admin = 't'" + "SELECT u.id FROM users u WHERE u.admin" when :moderators - "SELECT u.id FROM users u WHERE u.moderator = 't'" + "SELECT u.id FROM users u WHERE u.moderator" when :staff - "SELECT u.id FROM users u WHERE u.moderator = 't' OR u.admin = 't'" + "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}" end diff --git a/app/models/user.rb b/app/models/user.rb index 28467c99427..28d3686f5ed 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -60,7 +60,7 @@ class User < ActiveRecord::Base scope :admins, ->{ where(admin: true) } scope :moderators, ->{ where(moderator: true) } - scope :staff, ->{ where("moderator = 't' or admin = 't'") } + scope :staff, ->{ where("moderator or admin ") } module NewTopicDuration ALWAYS = -1