app/controllers/admin/user_creations_controller.rb
def hide
    creation_class = params[:creation_type].constantize
    creation = creation_class.find(params[:id])
    creation.hidden_by_admin = (params[:hidden] == "true")
    creation.save(:validate => false)
    action = creation.hidden_by_admin? ? "hide" : "unhide"
    AdminActivity.log_action(current_admin, creation, action: action)
    flash[:notice] = creation.hidden_by_admin? ? 
                        ts('Item has been hidden.') :
                        ts('Item is no longer hidden.')
    if creation_class == Comment
      redirect_to(creation.ultimate_parent) 
    elsif creation_class == ExternalWork
      redirect_to(request.env["HTTP_REFERER"] || root_path)
    else
      unless action  == "unhide"
        # Email users so they're aware of Abuse action
        orphan_account = User.orphan_account
        users = creation.pseuds.map(&:user).uniq
        users.each do |user|
          unless user == orphan_account
            UserMailer.admin_hidden_work_notification(creation.id, user.id).deliver
          end
        end
       end
      redirect_to(creation)
    end
  end
# Removes an object from public view
Removes an object from public view
Removes an object from public view
def hide
    creation_class = params[:creation_type].constantize
    creation = creation_class.find(params[:id])
    creation.hidden_by_admin = (params[:hidden] == "true")
    creation.save(:validate => false)
    action = creation.hidden_by_admin? ? "hide" : "unhide"
    AdminActivity.log_action(current_admin, creation, action: action)
    flash[:notice] = creation.hidden_by_admin? ? 
                        ts('Item has been hidden.') :
                        ts('Item is no longer hidden.')
    if creation_class == Comment
      redirect_to(creation.ultimate_parent) 
    elsif creation_class == ExternalWork
      redirect_to(request.env["HTTP_REFERER"] || root_path)
    else
      unless action  == "unhide"
        orphan_account = User.orphan_account
        users = creation.pseuds.map(&:user).uniq
        users.each do |user|
          unless user == orphan_account
            UserMailer.admin_hidden_work_notification(creation.id, user.id).deliver
          end
        end
       end
      redirect_to(creation)
    end
  end
def hide creation_class = params [ :creation_type ] . constantize creation = creation_class . find ( params [ :id ] ) creation . hidden_by_admin = ( params [ :hidden ] == "true" ) creation . save ( :validate => false ) action = creation . hidden_by_admin? ? "hide" : "unhide" AdminActivity . log_action ( current_admin , creation , action : action ) flash [ :notice ] = creation . hidden_by_admin? ? ts ( 'Item has been hidden.' ) : ts ( 'Item is no longer hidden.' ) if creation_class == Comment redirect_to ( creation . ultimate_parent ) elsif creation_class == ExternalWork redirect_to ( request . env [ "HTTP_REFERER" ] || root_path ) else unless action == "unhide" orphan_account = User . orphan_account users = creation . pseuds . map ( & :user ) . uniq users . each do | user | unless user == orphan_account UserMailer . admin_hidden_work_notification ( creation . id , user . id ) . deliver end end end redirect_to ( creation ) end end
Removes an object from public view
Removes an object from public view
# Email users so they're aware of Abuse action