Move common module inclusion in sub classes to `ActivityPub::BaseController` (#29560)
parent
2e91a9bd34
commit
7720c684c5
|
@ -1,6 +1,9 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ActivityPub::BaseController < Api::BaseController
|
class ActivityPub::BaseController < Api::BaseController
|
||||||
|
include SignatureVerification
|
||||||
|
include AccountOwnedConcern
|
||||||
|
|
||||||
skip_before_action :require_authenticated_user!
|
skip_before_action :require_authenticated_user!
|
||||||
skip_before_action :require_not_suspended!
|
skip_before_action :require_not_suspended!
|
||||||
skip_around_action :set_locale
|
skip_around_action :set_locale
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ActivityPub::ClaimsController < ActivityPub::BaseController
|
class ActivityPub::ClaimsController < ActivityPub::BaseController
|
||||||
include SignatureVerification
|
|
||||||
include AccountOwnedConcern
|
|
||||||
|
|
||||||
skip_before_action :authenticate_user!
|
skip_before_action :authenticate_user!
|
||||||
|
|
||||||
before_action :require_account_signature!
|
before_action :require_account_signature!
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ActivityPub::CollectionsController < ActivityPub::BaseController
|
class ActivityPub::CollectionsController < ActivityPub::BaseController
|
||||||
include SignatureVerification
|
|
||||||
include AccountOwnedConcern
|
|
||||||
|
|
||||||
vary_by -> { 'Signature' if authorized_fetch_mode? }
|
vary_by -> { 'Signature' if authorized_fetch_mode? }
|
||||||
|
|
||||||
before_action :require_account_signature!, if: :authorized_fetch_mode?
|
before_action :require_account_signature!, if: :authorized_fetch_mode?
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ActivityPub::FollowersSynchronizationsController < ActivityPub::BaseController
|
class ActivityPub::FollowersSynchronizationsController < ActivityPub::BaseController
|
||||||
include SignatureVerification
|
|
||||||
include AccountOwnedConcern
|
|
||||||
|
|
||||||
vary_by -> { 'Signature' if authorized_fetch_mode? }
|
vary_by -> { 'Signature' if authorized_fetch_mode? }
|
||||||
|
|
||||||
before_action :require_account_signature!
|
before_action :require_account_signature!
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ActivityPub::InboxesController < ActivityPub::BaseController
|
class ActivityPub::InboxesController < ActivityPub::BaseController
|
||||||
include SignatureVerification
|
|
||||||
include JsonLdHelper
|
include JsonLdHelper
|
||||||
include AccountOwnedConcern
|
|
||||||
|
|
||||||
before_action :skip_unknown_actor_activity
|
before_action :skip_unknown_actor_activity
|
||||||
before_action :require_actor_signature!
|
before_action :require_actor_signature!
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
class ActivityPub::OutboxesController < ActivityPub::BaseController
|
class ActivityPub::OutboxesController < ActivityPub::BaseController
|
||||||
LIMIT = 20
|
LIMIT = 20
|
||||||
|
|
||||||
include SignatureVerification
|
|
||||||
include AccountOwnedConcern
|
|
||||||
|
|
||||||
vary_by -> { 'Signature' if authorized_fetch_mode? || page_requested? }
|
vary_by -> { 'Signature' if authorized_fetch_mode? || page_requested? }
|
||||||
|
|
||||||
before_action :require_account_signature!, if: :authorized_fetch_mode?
|
before_action :require_account_signature!, if: :authorized_fetch_mode?
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ActivityPub::RepliesController < ActivityPub::BaseController
|
class ActivityPub::RepliesController < ActivityPub::BaseController
|
||||||
include SignatureVerification
|
|
||||||
include Authorization
|
include Authorization
|
||||||
include AccountOwnedConcern
|
|
||||||
|
|
||||||
DESCENDANTS_LIMIT = 60
|
DESCENDANTS_LIMIT = 60
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ class InstanceActorsController < ActivityPub::BaseController
|
||||||
serialization_scope nil
|
serialization_scope nil
|
||||||
|
|
||||||
before_action :set_account
|
before_action :set_account
|
||||||
|
|
||||||
|
skip_before_action :authenticate_user! # From `AccountOwnedConcern`
|
||||||
skip_before_action :require_functional!
|
skip_before_action :require_functional!
|
||||||
skip_before_action :update_user_sign_in
|
skip_before_action :update_user_sign_in
|
||||||
|
|
||||||
|
@ -16,6 +18,11 @@ class InstanceActorsController < ActivityPub::BaseController
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
# Skips various `before_action` from `AccountOwnedConcern`
|
||||||
|
def account_required?
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
def set_account
|
def set_account
|
||||||
@account = Account.representative
|
@account = Account.representative
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue