File cleanup/organization in `controllers/concerns` (#27846)
This commit is contained in:
parent
0530ce5e95
commit
1f1c75bba5
|
@ -4,7 +4,7 @@ require 'csv'
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class ExportDomainAllowsController < BaseController
|
class ExportDomainAllowsController < BaseController
|
||||||
include AdminExportControllerConcern
|
include Admin::ExportControllerConcern
|
||||||
|
|
||||||
before_action :set_dummy_import!, only: [:new]
|
before_action :set_dummy_import!, only: [:new]
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ require 'csv'
|
||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class ExportDomainBlocksController < BaseController
|
class ExportDomainBlocksController < BaseController
|
||||||
include AdminExportControllerConcern
|
include Admin::ExportControllerConcern
|
||||||
|
|
||||||
before_action :set_dummy_import!, only: [:new]
|
before_action :set_dummy_import!, only: [:new]
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ class Api::BaseController < ApplicationController
|
||||||
DEFAULT_STATUSES_LIMIT = 20
|
DEFAULT_STATUSES_LIMIT = 20
|
||||||
DEFAULT_ACCOUNTS_LIMIT = 40
|
DEFAULT_ACCOUNTS_LIMIT = 40
|
||||||
|
|
||||||
include RateLimitHeaders
|
include Api::RateLimitHeaders
|
||||||
include AccessTokenTrackingConcern
|
include Api::AccessTokenTrackingConcern
|
||||||
include ApiCachingConcern
|
include Api::CachingConcern
|
||||||
include Api::ContentSecurityPolicy
|
include Api::ContentSecurityPolicy
|
||||||
|
|
||||||
skip_before_action :require_functional!, unless: :limited_federation_mode?
|
skip_before_action :require_functional!, unless: :limited_federation_mode?
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Auth::ConfirmationsController < Devise::ConfirmationsController
|
class Auth::ConfirmationsController < Devise::ConfirmationsController
|
||||||
include CaptchaConcern
|
include Auth::CaptchaConcern
|
||||||
|
|
||||||
layout 'auth'
|
layout 'auth'
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class Auth::RegistrationsController < Devise::RegistrationsController
|
class Auth::RegistrationsController < Devise::RegistrationsController
|
||||||
include RegistrationHelper
|
include RegistrationHelper
|
||||||
include RegistrationSpamConcern
|
include Auth::RegistrationSpamConcern
|
||||||
|
|
||||||
layout :determine_layout
|
layout :determine_layout
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Auth::SessionsController < Devise::SessionsController
|
||||||
|
|
||||||
prepend_before_action :check_suspicious!, only: [:create]
|
prepend_before_action :check_suspicious!, only: [:create]
|
||||||
|
|
||||||
include TwoFactorAuthenticationConcern
|
include Auth::TwoFactorAuthenticationConcern
|
||||||
|
|
||||||
before_action :set_body_classes
|
before_action :set_body_classes
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module AdminExportControllerConcern
|
module Admin::ExportControllerConcern
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
private
|
private
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module AccessTokenTrackingConcern
|
module Api::AccessTokenTrackingConcern
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
ACCESS_TOKEN_UPDATE_FREQUENCY = 24.hours.freeze
|
ACCESS_TOKEN_UPDATE_FREQUENCY = 24.hours.freeze
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module ApiCachingConcern
|
module Api::CachingConcern
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
def cache_if_unauthenticated!
|
def cache_if_unauthenticated!
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module RateLimitHeaders
|
module Api::RateLimitHeaders
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
class_methods do
|
class_methods do
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module CaptchaConcern
|
module Auth::CaptchaConcern
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
include Hcaptcha::Adapters::ViewMethods
|
include Hcaptcha::Adapters::ViewMethods
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module RegistrationSpamConcern
|
module Auth::RegistrationSpamConcern
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
def set_registration_form_time
|
def set_registration_form_time
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module TwoFactorAuthenticationConcern
|
module Auth::TwoFactorAuthenticationConcern
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module ExportControllerConcern
|
module Settings::ExportControllerConcern
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
|
@ -3,7 +3,7 @@
|
||||||
module Settings
|
module Settings
|
||||||
module Exports
|
module Exports
|
||||||
class BlockedAccountsController < BaseController
|
class BlockedAccountsController < BaseController
|
||||||
include ExportControllerConcern
|
include Settings::ExportControllerConcern
|
||||||
|
|
||||||
def index
|
def index
|
||||||
send_export_file
|
send_export_file
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
module Settings
|
module Settings
|
||||||
module Exports
|
module Exports
|
||||||
class BlockedDomainsController < BaseController
|
class BlockedDomainsController < BaseController
|
||||||
include ExportControllerConcern
|
include Settings::ExportControllerConcern
|
||||||
|
|
||||||
def index
|
def index
|
||||||
send_export_file
|
send_export_file
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
module Settings
|
module Settings
|
||||||
module Exports
|
module Exports
|
||||||
class BookmarksController < BaseController
|
class BookmarksController < BaseController
|
||||||
include ExportControllerConcern
|
include Settings::ExportControllerConcern
|
||||||
|
|
||||||
def index
|
def index
|
||||||
send_export_file
|
send_export_file
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
module Settings
|
module Settings
|
||||||
module Exports
|
module Exports
|
||||||
class FollowingAccountsController < BaseController
|
class FollowingAccountsController < BaseController
|
||||||
include ExportControllerConcern
|
include Settings::ExportControllerConcern
|
||||||
|
|
||||||
def index
|
def index
|
||||||
send_export_file
|
send_export_file
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
module Settings
|
module Settings
|
||||||
module Exports
|
module Exports
|
||||||
class ListsController < BaseController
|
class ListsController < BaseController
|
||||||
include ExportControllerConcern
|
include Settings::ExportControllerConcern
|
||||||
|
|
||||||
def index
|
def index
|
||||||
send_export_file
|
send_export_file
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
module Settings
|
module Settings
|
||||||
module Exports
|
module Exports
|
||||||
class MutedAccountsController < BaseController
|
class MutedAccountsController < BaseController
|
||||||
include ExportControllerConcern
|
include Settings::ExportControllerConcern
|
||||||
|
|
||||||
def index
|
def index
|
||||||
send_export_file
|
send_export_file
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe RateLimitHeaders do
|
describe Api::RateLimitHeaders do
|
||||||
controller(ApplicationController) do
|
controller(ApplicationController) do
|
||||||
include RateLimitHeaders
|
include Api::RateLimitHeaders
|
||||||
|
|
||||||
def show
|
def show
|
||||||
head 200
|
head 200
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe ExportControllerConcern do
|
describe Settings::ExportControllerConcern do
|
||||||
controller(ApplicationController) do
|
controller(ApplicationController) do
|
||||||
include ExportControllerConcern
|
include Settings::ExportControllerConcern
|
||||||
|
|
||||||
def index
|
def index
|
||||||
send_export_file
|
send_export_file
|
Loading…
Reference in New Issue