From 565f7e4536c91f037026121bac9b5d9756276de1 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 3 Jul 2022 21:41:50 +0200 Subject: [PATCH] Move data action into `Settings::DataController` --- app/controllers/settings/data_controller.rb | 7 +++++++ app/controllers/user_controller.rb | 5 ----- config/routes.rb | 6 ++---- 3 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 app/controllers/settings/data_controller.rb diff --git a/app/controllers/settings/data_controller.rb b/app/controllers/settings/data_controller.rb new file mode 100644 index 00000000..5aa695d2 --- /dev/null +++ b/app/controllers/settings/data_controller.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class Settings::DataController < ApplicationController + before_action :authenticate_user! + + def index; end +end diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 25233dd8..91b557d1 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -1,6 +1,4 @@ class UserController < ApplicationController - before_action :authenticate_user!, only: %w[data] - def show @user = User.where('LOWER(screen_name) = ?', params[:username].downcase).includes(:profile).first! @answers = @user.cursored_answers(last_id: params[:last_id]) @@ -65,7 +63,4 @@ class UserController < ApplicationController format.js { render layout: false } end end - - def data - end end diff --git a/config/routes.rb b/config/routes.rb index 05090667..37052e35 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -79,6 +79,8 @@ Rails.application.routes.draw do get :blocks, to: 'blocks#index' + get :data, to: 'data#index' + namespace :two_factor_authentication do get :otp_authentication, to: 'otp_authentication#index' patch :otp_authentication, to: 'otp_authentication#update' @@ -89,8 +91,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/blocks', to: 'user#edit_blocks', via: :get, as: :edit_user_blocks - # resources :services, only: [:index, :destroy] match '/settings/services', to: 'services#index', via: 'get', as: :services match '/settings/services/:id', to: 'services#update', via: 'patch', as: :update_service @@ -102,8 +102,6 @@ Rails.application.routes.draw do end end - match '/settings/data', to: 'user#data', via: :get, as: :user_data - namespace :ajax do match '/ask', to: 'question#create', via: :post, as: :ask match '/destroy_question', to: 'question#destroy', via: :post, as: :destroy_question