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_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

View File

@ -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

View File

@ -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"