From f1f6e5ccc94181a7d38234c63741a2d339b7dbc7 Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 21 May 2017 12:27:39 -0500 Subject: [PATCH] anonymous_user.rb: generate is_? methods from User::Roles. --- app/logical/anonymous_user.rb | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/app/logical/anonymous_user.rb b/app/logical/anonymous_user.rb index 3dacd7798..65b458049 100644 --- a/app/logical/anonymous_user.rb +++ b/app/logical/anonymous_user.rb @@ -8,6 +8,10 @@ class AnonymousUser 0 end + def level_string + "Anonymous" + end + def comment_threshold 0 end @@ -36,10 +40,6 @@ class AnonymousUser true end - def is_banned? - false - end - def is_banned_or_ip_banned? false end @@ -245,14 +245,6 @@ class AnonymousUser false end - def is_voter? - false - end - - def is_super_voter? - false - end - def disable_tagged_filenames? false end @@ -261,7 +253,7 @@ class AnonymousUser false end - %w(member banned gold builder platinum moderator admin).each do |name| + User::Roles.reject {|r| r == :anonymous}.each do |name| define_method("is_#{name}?") do false end