diff options
author | Gareth Rees <gareth@mysociety.org> | 2015-02-24 13:36:58 +0000 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2015-02-24 13:36:58 +0000 |
commit | b7822e944b75e97db31b1d56249058ee02ce198b (patch) | |
tree | 1412a43c70b0ef6a2a245953d5b4583297ce65ab /app/models/user.rb | |
parent | f7974a3c5243279f9a739a7d84174af953b38434 (diff) | |
parent | d8b9ea8bfe9fdf534504044774f0dcdb4bba20f2 (diff) |
Merge branch '2160-banned-user-edits' into rails-3-develop
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index c953e52f2..920c0da46 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -207,7 +207,7 @@ class User < ActiveRecord::Base if not name.nil? name.strip! end - if public_banned? + if banned? # Use interpolation to return a string rather than a SafeBuffer so that # gsub can be called on it until we upgrade to Rails 3.2. The name returned # is not marked as HTML safe so will be escaped automatically in views. We @@ -294,10 +294,18 @@ class User < ActiveRecord::Base def admin_page_links? super? end + # Is it public that they are banned? + def banned? + !ban_text.empty? + end + def public_banned? - !ban_text.empty? + warn %q([DEPRECATION] User#public_banned? will be replaced with + User#banned? as of 0.22).squish + banned? end + # Various ways the user can be banned, and text to describe it if failed def can_file_requests? ban_text.empty? && !exceeded_limit? |