From 364113a4d573a15854325d0ff3836c5bf94d849f Mon Sep 17 00:00:00 2001 From: nirnanaaa Date: Wed, 29 May 2013 21:46:03 +0200 Subject: [PATCH] removed t and f 's from group model removed t and f 's from user model as mentioned in #919 removed t's and f's from category model --- app/models/category.rb | 4 ++-- app/models/group.rb | 6 +++--- app/models/user.rb | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) 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