Remove all other references to removed roles

This commit is contained in:
Karina Kwiatek 2020-04-25 21:20:02 +01:00
parent 9d933c933e
commit f42cc6aed9
3 changed files with 5 additions and 21 deletions

View File

@ -441,7 +441,7 @@ namespace :justask do
export_dirname = "export_#{u.screen_name}_#{Time.now.to_i}" export_dirname = "export_#{u.screen_name}_#{Time.now.to_i}"
export_filename = u.screen_name 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 obj[f] = u.send f
end end

View File

@ -164,9 +164,9 @@ class Ajax::ModerationController < ApplicationController
target_user = User.find_by_screen_name(params[:user]) target_user = User.find_by_screen_name(params[:user])
@message = I18n.t('messages.moderation.privilege.nope') @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 @status = :nopriv
@message = I18n.t('messages.moderation.privilege.nopriv') @message = I18n.t('messages.moderation.privilege.nopriv')
@success = false @success = false
@ -176,16 +176,8 @@ class Ajax::ModerationController < ApplicationController
@checked = status @checked = status
type = params[:type].downcase type = params[:type].downcase
target_role = {"admin" => "administrator"}.fetch(type, type).to_sym target_role = {"admin" => "administrator"}.fetch(type, type).to_sym
case type
when 'blogger' if %w(moderator admin).include? type
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 status if status
target_user.add_role target_role target_user.add_role target_role
else else

View File

@ -438,19 +438,11 @@ en:
name: "Group name" name: "Group name"
members: "members" members: "members"
privilege: 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." moderator: "Someone trustworthy enough to help managing reports."
admin: "This user is part of the core team." admin: "This user is part of the core team."
translator: "This user helped translating Retrospring into their language."
user: user:
follows_you: "Follows you" follows_you: "Follows you"
title: title:
admin: "Admin" admin: "Admin"
moderator: "Moderator" moderator: "Moderator"
supporter: "Supporter"
contributor: "Contributor"
blogger: "Blogger"
banned: "Banned" banned: "Banned"
translator: "Translator"