Move block action into `Settings::BlocksController`

This commit is contained in:
Andreas Nedbal 2022-07-03 21:31:39 +02:00 committed by Karina Kwiatek
parent 6b5e59fa1c
commit 72d37032e6
3 changed files with 13 additions and 6 deletions

View File

@ -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

View File

@ -1,5 +1,5 @@
class UserController < ApplicationController class UserController < ApplicationController
before_action :authenticate_user!, only: %w[data edit_blocks] before_action :authenticate_user!, only: %w[data]
def show def show
@user = User.where('LOWER(screen_name) = ?', params[:username].downcase).includes(:profile).first! @user = User.where('LOWER(screen_name) = ?', params[:username].downcase).includes(:profile).first!
@ -68,9 +68,4 @@ class UserController < ApplicationController
def data def data
end end
def edit_blocks
@blocks = Relationships::Block.where(source: current_user)
@anonymous_blocks = AnonymousBlock.where(user: current_user)
end
end end

View File

@ -77,6 +77,8 @@ Rails.application.routes.draw do
get :muted, to: 'mutes#index' get :muted, to: 'mutes#index'
get :blocks, to: 'blocks#index'
namespace :two_factor_authentication do namespace :two_factor_authentication do
get :otp_authentication, to: 'otp_authentication#index' get :otp_authentication, to: 'otp_authentication#index'
patch :otp_authentication, to: 'otp_authentication#update' patch :otp_authentication, to: 'otp_authentication#update'