Move data action into Settings::DataController

This commit is contained in:
Andreas Nedbal 2022-07-03 21:41:50 +02:00 committed by Karina Kwiatek
parent 4fcff867ae
commit 565f7e4536
3 changed files with 9 additions and 9 deletions

View file

@ -0,0 +1,7 @@
# frozen_string_literal: true
class Settings::DataController < ApplicationController
before_action :authenticate_user!
def index; end
end

View file

@ -1,6 +1,4 @@
class UserController < ApplicationController class UserController < ApplicationController
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!
@answers = @user.cursored_answers(last_id: params[:last_id]) @answers = @user.cursored_answers(last_id: params[:last_id])
@ -65,7 +63,4 @@ class UserController < ApplicationController
format.js { render layout: false } format.js { render layout: false }
end end
end end
def data
end
end end

View file

@ -79,6 +79,8 @@ Rails.application.routes.draw do
get :blocks, to: 'blocks#index' get :blocks, to: 'blocks#index'
get :data, to: 'data#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'
@ -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('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] } resolve('Profile') { [:settings_profile] }
match '/settings/blocks', to: 'user#edit_blocks', via: :get, as: :edit_user_blocks
# resources :services, only: [:index, :destroy] # resources :services, only: [:index, :destroy]
match '/settings/services', to: 'services#index', via: 'get', as: :services match '/settings/services', to: 'services#index', via: 'get', as: :services
match '/settings/services/:id', to: 'services#update', via: 'patch', as: :update_service match '/settings/services/:id', to: 'services#update', via: 'patch', as: :update_service
@ -102,8 +102,6 @@ Rails.application.routes.draw do
end end
end end
match '/settings/data', to: 'user#data', via: :get, as: :user_data
namespace :ajax do namespace :ajax do
match '/ask', to: 'question#create', via: :post, as: :ask match '/ask', to: 'question#create', via: :post, as: :ask
match '/destroy_question', to: 'question#destroy', via: :post, as: :destroy_question match '/destroy_question', to: 'question#destroy', via: :post, as: :destroy_question