app/controllers/application_controller.rb
# Prevents banned and suspended users from adding/editing content
Prevents banned and suspended users from adding/editing content
Prevents banned and suspended users from adding / editing content
def check_user_status
    if current_user.is_a?(User) && (current_user.suspended? || current_user.banned?)
      if current_user.suspended?
        flash[:error] = t('suspension_notice', default: "Your account has been suspended until %{suspended_until}. You may not add or edit content until your suspension has been resolved. Please <a href=\"#{new_abuse_report_path}\">contact Abuse</a> for more information.", suspended_until: localize(current_user.suspended_until)).html_safe
      else
        flash[:error] = t('ban_notice', default: "Your account has been banned. You are not permitted to add or edit archive content. Please <a href=\"#{new_abuse_report_path}\">contact Abuse</a> for more information.").html_safe
      end
      redirect_to current_user
    end
  end
def check_user_status if current_user . is_a? ( User ) && ( current_user . suspended? || current_user . banned? ) if current_user . suspended? flash [ :error ] = t ( 'suspension_notice' , default : "Your account has been suspended until %{suspended_until}. You may not add or edit content until your suspension has been resolved. Please <a href=\"#{new_abuse_report_path}\">contact Abuse</a> for more information." , suspended_until : localize ( current_user . suspended_until ) ) . html_safe else flash [ :error ] = t ( 'ban_notice' , default : "Your account has been banned. You are not permitted to add or edit archive content. Please <a href=\"#{new_abuse_report_path}\">contact Abuse</a> for more information." ) . html_safe end redirect_to current_user end end
Prevents banned and suspended users from adding/editing content
Prevents banned and suspended users from adding / editing content