2 class StatusesController < ApplicationController
5 before_action :authorize_web
6 before_action :set_locale
7 before_action :check_database_readable
9 authorize_resource :class => :user_status
11 before_action :lookup_user_by_name
14 # sets a user's status
16 @user.activate! if params[:event] == "activate"
17 @user.confirm! if params[:event] == "confirm"
18 @user.unconfirm! if params[:event] == "unconfirm"
19 @user.hide! if params[:event] == "hide"
20 @user.unhide! if params[:event] == "unhide"
21 @user.unsuspend! if params[:event] == "unsuspend"
22 @user.soft_destroy! if params[:event] == "soft_destroy" # destroy a user, marking them as deleted and removing personal data
23 redirect_to user_path(params[:user_display_name])
29 # ensure that there is a "user" instance variable
30 def lookup_user_by_name
31 @user = User.find_by!(:display_name => params[:user_display_name])
32 rescue ActiveRecord::RecordNotFound
33 redirect_to user_path(params[:user_display_name]) unless @user