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