2 class ReceivedBlocksController < ApplicationController
4 include PaginationMethods
8 before_action :authorize_web
9 before_action :set_locale
11 authorize_resource :class => UserBlock
13 before_action :lookup_user
14 before_action :check_database_readable
15 before_action :check_database_writable, :only => :destroy
18 # shows a list of all the blocks on the given user
20 @params = params.permit(:user_display_name)
22 user_blocks = UserBlock.where(:user => @user)
24 @user_blocks, @newer_user_blocks_id, @older_user_blocks_id = get_page_items(user_blocks, :includes => [:user, :creator, :revoker])
26 @show_user_name = false
27 @show_creator_name = true
29 render :partial => "user_blocks/page" if turbo_frame_request_id == "pagination"
33 # shows revoke all active blocks page
37 # revokes all active blocks
40 @user.blocks.active.each { |block| block.revoke!(current_user) }
41 flash[:notice] = t ".flash"
42 redirect_to user_received_blocks_path(@user)
44 render :action => :edit