From f42cc6aed9b95a80e3ca66ef6dae2ab5c3688601 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Sat, 25 Apr 2020 21:20:02 +0100 Subject: [PATCH] Remove all other references to removed roles --- Rakefile | 2 +- app/controllers/ajax/moderation_controller.rb | 16 ++++------------ config/locales/en.yml | 8 -------- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/Rakefile b/Rakefile index 1fe43af8..a526ee7a 100644 --- a/Rakefile +++ b/Rakefile @@ -441,7 +441,7 @@ namespace :justask do export_dirname = "export_#{u.screen_name}_#{Time.now.to_i}" export_filename = u.screen_name - %i(id screen_name display_name created_at sign_in_count last_sign_in_at friend_count follower_count asked_count answered_count commented_count smiled_count motivation_header bio website location moderator admin supporter banned blogger).each do |f| + %i(id screen_name display_name created_at sign_in_count last_sign_in_at friend_count follower_count asked_count answered_count commented_count smiled_count motivation_header bio website location moderator admin banned).each do |f| obj[f] = u.send f end diff --git a/app/controllers/ajax/moderation_controller.rb b/app/controllers/ajax/moderation_controller.rb index 9ec82abb..7aa86ffe 100644 --- a/app/controllers/ajax/moderation_controller.rb +++ b/app/controllers/ajax/moderation_controller.rb @@ -164,9 +164,9 @@ class Ajax::ModerationController < ApplicationController target_user = User.find_by_screen_name(params[:user]) @message = I18n.t('messages.moderation.privilege.nope') - return unless %w(blogger supporter moderator admin contributor translator).include? params[:type].downcase + return unless %w(moderator admin).include? params[:type].downcase - if %w(supporter moderator admin).include?(params[:type].downcase) && !current_user.has_role?(:administrator) + if %w(moderator admin).include?(params[:type].downcase) && !current_user.has_role?(:administrator) @status = :nopriv @message = I18n.t('messages.moderation.privilege.nopriv') @success = false @@ -176,16 +176,8 @@ class Ajax::ModerationController < ApplicationController @checked = status type = params[:type].downcase target_role = {"admin" => "administrator"}.fetch(type, type).to_sym - case type - when 'blogger' - target_user.blogger = status - when 'contributor' - target_user.contributor = status - when 'translator' - target_user.translator = status - when 'supporter' - target_user.supporter = status - when 'moderator', 'admin' + + if %w(moderator admin).include? type if status target_user.add_role target_role else diff --git a/config/locales/en.yml b/config/locales/en.yml index 23636ddb..bf3b2a0d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -438,19 +438,11 @@ en: name: "Group name" members: "members" privilege: - blogger: "The user gets that privilege if they blogged something (nice) about Retrospring." - contributor: "This user has contributed to justask (the software behind Retrospring)." - supporter: "This user monetarily supports the site." moderator: "Someone trustworthy enough to help managing reports." admin: "This user is part of the core team." - translator: "This user helped translating Retrospring into their language." user: follows_you: "Follows you" title: admin: "Admin" moderator: "Moderator" - supporter: "Supporter" - contributor: "Contributor" - blogger: "Blogger" banned: "Banned" - translator: "Translator"