Move mute action into `Settings::MutesController`

This commit is contained in:
Andreas Nedbal 2022-07-03 21:11:17 +02:00 committed by Karina Kwiatek
parent 917e32b4fc
commit a4bc137aca
3 changed files with 12 additions and 8 deletions

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
class Settings::MutesController < ApplicationController
before_action :authenticate_user!
def index
@rules = MuteRule.where(user: current_user)
end
end

View File

@ -1,5 +1,5 @@
class UserController < ApplicationController
before_action :authenticate_user!, only: %w[data edit_mute edit_blocks]
before_action :authenticate_user!, only: %w[data edit_blocks]
def show
@user = User.where('LOWER(screen_name) = ?', params[:username].downcase).includes(:profile).first!
@ -69,12 +69,6 @@ class UserController < ApplicationController
def data
end
# region Muting
def edit_mute
@rules = MuteRule.where(user: current_user)
end
# endregion
def edit_blocks
@blocks = Relationships::Block.where(source: current_user)
@anonymous_blocks = AnonymousBlock.where(user: current_user)

View File

@ -75,6 +75,8 @@ Rails.application.routes.draw do
get :export, to: 'export#index'
post :export, to: 'export#create'
get :muted, to: 'mutes#index'
namespace :two_factor_authentication do
get :otp_authentication, to: 'otp_authentication#index'
patch :otp_authentication, to: 'otp_authentication#update'
@ -85,7 +87,6 @@ Rails.application.routes.draw do
resolve('Theme') { [:settings_theme] } # to make link_to/form_for work nicely when passing a `Theme` object to it, see also: https://api.rubyonrails.org/v6.1.5.1/classes/ActionDispatch/Routing/Mapper/CustomUrls.html#method-i-resolve
resolve('Profile') { [:settings_profile] }
match '/settings/muted', to: 'user#edit_mute', via: :get, as: :edit_user_mute_rules
match '/settings/blocks', to: 'user#edit_blocks', via: :get, as: :edit_user_blocks
# resources :services, only: [:index, :destroy]