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') @message = I18n.t('messages.moderation.privilege.nope')
return unless %w(moderator admin).include? params[:type].downcase 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 @status = :nopriv
@message = I18n.t('messages.moderation.privilege.nopriv') @message = I18n.t('messages.moderation.privilege.nopriv')
@success = false @success = false
@ -177,12 +177,10 @@ class Ajax::ModerationController < ApplicationController
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
if %w(moderator admin).include? type if status
if status target_user.add_role target_role
target_user.add_role target_role else
else target_user.remove_role target_role
target_user.remove_role target_role
end
end end
target_user.save! target_user.save!

View file

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

View file

@ -37,14 +37,6 @@
%h4.heading-about.text-center= t 'views.about.repository.title' %h4.heading-about.text-center= t 'views.about.repository.title'
%p.text-center %p.text-center
%em= t 'views.about.repository.desc' %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.panel-default
.panel-body .panel-body
.row .row
@ -57,9 +49,9 @@
%h2.entry-text#answered-count= Answer.count %h2.entry-text#answered-count= Answer.count
%h4.entry-subtext= t('views.general.answer').pluralize(Answer.count) %h4.entry-subtext= t('views.general.answer').pluralize(Answer.count)
.col-md-3.col-sm-6.col-xs-6.statistics .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) %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) %h4.entry-subtext= t('views.general.smile').pluralize(Smile.count)
.col-md-3.col-sm-12.col-xs-12.users .col-md-3.col-sm-12.col-xs-12.users
.entry-text#follower-count= User.count .entry-text#follower-count= User.count