Move common module inclusion in sub classes to `ActivityPub::BaseController` (#29560)

This commit is contained in:
Matt Jankowski 2024-03-15 06:40:21 -04:00 committed by GitHub
parent 2e91a9bd34
commit 7720c684c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 10 additions and 16 deletions

View File

@ -1,6 +1,9 @@
# frozen_string_literal: true
class ActivityPub::BaseController < Api::BaseController
include SignatureVerification
include AccountOwnedConcern
skip_before_action :require_authenticated_user!
skip_before_action :require_not_suspended!
skip_around_action :set_locale

View File

@ -1,9 +1,6 @@
# frozen_string_literal: true
class ActivityPub::ClaimsController < ActivityPub::BaseController
include SignatureVerification
include AccountOwnedConcern
skip_before_action :authenticate_user!
before_action :require_account_signature!

View File

@ -1,9 +1,6 @@
# frozen_string_literal: true
class ActivityPub::CollectionsController < ActivityPub::BaseController
include SignatureVerification
include AccountOwnedConcern
vary_by -> { 'Signature' if authorized_fetch_mode? }
before_action :require_account_signature!, if: :authorized_fetch_mode?

View File

@ -1,9 +1,6 @@
# frozen_string_literal: true
class ActivityPub::FollowersSynchronizationsController < ActivityPub::BaseController
include SignatureVerification
include AccountOwnedConcern
vary_by -> { 'Signature' if authorized_fetch_mode? }
before_action :require_account_signature!

View File

@ -1,9 +1,7 @@
# frozen_string_literal: true
class ActivityPub::InboxesController < ActivityPub::BaseController
include SignatureVerification
include JsonLdHelper
include AccountOwnedConcern
before_action :skip_unknown_actor_activity
before_action :require_actor_signature!

View File

@ -3,9 +3,6 @@
class ActivityPub::OutboxesController < ActivityPub::BaseController
LIMIT = 20
include SignatureVerification
include AccountOwnedConcern
vary_by -> { 'Signature' if authorized_fetch_mode? || page_requested? }
before_action :require_account_signature!, if: :authorized_fetch_mode?

View File

@ -1,9 +1,7 @@
# frozen_string_literal: true
class ActivityPub::RepliesController < ActivityPub::BaseController
include SignatureVerification
include Authorization
include AccountOwnedConcern
DESCENDANTS_LIMIT = 60

View File

@ -6,6 +6,8 @@ class InstanceActorsController < ActivityPub::BaseController
serialization_scope nil
before_action :set_account
skip_before_action :authenticate_user! # From `AccountOwnedConcern`
skip_before_action :require_functional!
skip_before_action :update_user_sign_in
@ -16,6 +18,11 @@ class InstanceActorsController < ActivityPub::BaseController
private
# Skips various `before_action` from `AccountOwnedConcern`
def account_required?
false
end
def set_account
@account = Account.representative
end