diff --git a/app/logical/janitor_pruner.rb b/app/logical/janitor_pruner.rb index e00ebc822..025255e6e 100644 --- a/app/logical/janitor_pruner.rb +++ b/app/logical/janitor_pruner.rb @@ -11,18 +11,21 @@ class JanitorPruner inactive_janitors.each do |user| CurrentUser.scoped(admin, "127.0.0.1") do + janitor_trial = JanitorTrial.where(user_id: user.id).first + + if janitor_trial + janitor_trial.demote! + unknown_level = nil + else + user.promote_to!(User::Levels::PLATINUM) + unknown_level = "\n\nYour previous user level was unknown so your user level has defaulted to Platinum. If you feel this to be in error please reply to this message with your original level." + end + Dmail.create_split( :to_id => user.id, :title => "Janitor inactivity", - :body => "You haven't approved a post in the past two months. In order to make sure the list of active janitors is up-to-date, you have lost your janitor privileges. Please reply to this message if you want to be reinstated." + :body => "You haven't approved a post in the past two months. In order to make sure the list of active janitors is up-to-date, you have lost your janitor privileges. Please reply to this message if you want to be reinstated.#{unknown_level}" ) - - janitor_trial = JanitorTrial.where(user_id: user.id).first - if janitor_trial - user.promote_to!(janitor_trial.original_level, :skip_feedback => true) - else - user.promote_to!(User::Levels::GOLD, :skip_feedback => true) - end end end end diff --git a/app/models/janitor_trial.rb b/app/models/janitor_trial.rb index e1004d470..e0a4bac74 100644 --- a/app/models/janitor_trial.rb +++ b/app/models/janitor_trial.rb @@ -60,7 +60,7 @@ class JanitorTrial < ActiveRecord::Base end def send_dmail - body = "You have been selected as a test janitor. You can now approve pending posts and have access to the moderation interface. You should reacquaint yourself with the [[howto:upload]] guide to make sure you understand the site rules.\n\nOver the next several weeks your approvals will be monitored. If the majority of them are quality uploads, then you will be promoted to full janitor status which grants you the ability to delete and undelete posts, ban users, and revert tag changes from vandals. If you fail the trial period, you will be demoted back to your original level and you'll receive a negative user record indicating you previously attempted and failed a test janitor trial.\n\nThere is a minimum quota of 1 approval a month to indicate that you are being active. Remember, the goal isn't to approve as much as possible. It's to filter out borderline-quality art.\n\nIf you have any questions please respond to this message." + body = "You have been selected as a test janitor. You can now approve pending posts and have access to the moderation interface. You should reacquaint yourself with the [[howto:upload]] guide to make sure you understand the site rules.\n\nOver the next several weeks your approvals will be monitored. If the majority of them are quality uploads. If you fail the trial period, you will be demoted back to your original level and you'll receive a negative user record indicating you previously attempted and failed a test janitor trial.\n\nThere is a minimum quota of 1 approval a month to indicate that you are being active. Remember, the goal isn't to approve as much as possible. It's to filter out borderline-quality art.\n\nIf you have any questions please respond to this message." Dmail.create_split(:title => "Test Janitor Trial Period", :body => body, :to_id => user_id) end @@ -77,12 +77,10 @@ class JanitorTrial < ActiveRecord::Base end def promote! - destroy end def demote! user.update_column(:level, original_level) self.create_feedback - destroy end end