From 72d37032e6b4176e1e1f9acebd455413c0fe12d0 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 3 Jul 2022 21:31:39 +0200 Subject: [PATCH] Move block action into `Settings::BlocksController` --- app/controllers/settings/blocks_controller.rb | 10 ++++++++++ app/controllers/user_controller.rb | 7 +------ config/routes.rb | 2 ++ 3 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 app/controllers/settings/blocks_controller.rb diff --git a/app/controllers/settings/blocks_controller.rb b/app/controllers/settings/blocks_controller.rb new file mode 100644 index 00000000..d7477ce4 --- /dev/null +++ b/app/controllers/settings/blocks_controller.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class Settings::BlocksController < ApplicationController + before_action :authenticate_user! + + def index + @blocks = Relationships::Block.where(source: current_user) + @anonymous_blocks = AnonymousBlock.where(user: current_user) + end +end diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index cbfed383..25233dd8 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -1,5 +1,5 @@ class UserController < ApplicationController - before_action :authenticate_user!, only: %w[data edit_blocks] + before_action :authenticate_user!, only: %w[data] def show @user = User.where('LOWER(screen_name) = ?', params[:username].downcase).includes(:profile).first! @@ -68,9 +68,4 @@ class UserController < ApplicationController def data end - - def edit_blocks - @blocks = Relationships::Block.where(source: current_user) - @anonymous_blocks = AnonymousBlock.where(user: current_user) - end end diff --git a/config/routes.rb b/config/routes.rb index eade7642..05090667 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -77,6 +77,8 @@ Rails.application.routes.draw do get :muted, to: 'mutes#index' + get :blocks, to: 'blocks#index' + namespace :two_factor_authentication do get :otp_authentication, to: 'otp_authentication#index' patch :otp_authentication, to: 'otp_authentication#update'