Remove more left-over references to role fields

This commit is contained in:
Karina Kwiatek 2020-04-25 22:23:37 +01:00
parent 5db6f90b36
commit 926631eca3
3 changed files with 8 additions and 18 deletions

View File

@ -166,7 +166,7 @@ class Ajax::ModerationController < ApplicationController
@message = I18n.t('messages.moderation.privilege.nope')
return unless %w(moderator admin).include? params[:type].downcase
if %w(moderator admin).include?(params[:type].downcase) && !current_user.has_role?(:administrator)
unless current_user.has_role?(:administrator)
@status = :nopriv
@message = I18n.t('messages.moderation.privilege.nopriv')
@success = false
@ -177,13 +177,11 @@ class Ajax::ModerationController < ApplicationController
type = params[:type].downcase
target_role = {"admin" => "administrator"}.fetch(type, type).to_sym
if %w(moderator admin).include? type
if status
target_user.add_role target_role
else
target_user.remove_role target_role
end
end
target_user.save!
@message = I18n.t('messages.moderation.privilege.checked', privilege: params[:type])

View File

@ -12,7 +12,7 @@ class StaticController < ApplicationController
end
def about
@admins = User.where(admin: true).order(:id)
end
def faq

View File

@ -37,14 +37,6 @@
%h4.heading-about.text-center= t 'views.about.repository.title'
%p.text-center
%em= t 'views.about.repository.desc'
.col-md-4
%h3= t 'views.about.contributors.title'
%p= t('views.about.contributors.desc', app_title: APP_CONFIG['site_name'])
%p= raw t('views.about.contributors.howto', fork: link_to(t('views.about.contributors.fork'), "https://github.com/retrospring/retrospring"))
%ul.about--moderator
- User.where(contributor: true).each do |sup|
%a{href: show_user_profile_path(sup.screen_name), title: sup.screen_name, data: { toggle: :tooltip, placement: :top }}
%img.img-rounded.answerbox--img-small{src: sup.profile_picture.url(:medium)}
.panel.panel-default
.panel-body
.row
@ -57,9 +49,9 @@
%h2.entry-text#answered-count= Answer.count
%h4.entry-subtext= t('views.general.answer').pluralize(Answer.count)
.col-md-3.col-sm-6.col-xs-6.statistics
%h2.entry-text#asked-count= Comment.count
%h2.entry-text#comment-count= Comment.count
%h4.entry-subtext= t('views.general.comment').pluralize(Comment.count)
%h2.entry-text#answered-count= Smile.count + CommentSmile.count
%h2.entry-text#smile-count= Smile.count + CommentSmile.count
%h4.entry-subtext= t('views.general.smile').pluralize(Smile.count)
.col-md-3.col-sm-12.col-xs-12.users
.entry-text#follower-count= User.count