Fix Style/ClassEqualityComparison cop (#30058)

This commit is contained in:
Matt Jankowski 2024-06-21 11:33:55 -04:00 committed by GitHub
parent 72484a194f
commit 348ccf206e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 2 additions and 10 deletions

View file

@ -31,14 +31,6 @@ Rails/OutputSafety:
Exclude:
- 'config/initializers/simple_form.rb'
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowedMethods, AllowedPatterns.
# AllowedMethods: ==, equal?, eql?
Style/ClassEqualityComparison:
Exclude:
- 'app/helpers/jsonld_helper.rb'
- 'app/serializers/activitypub/outbox_serializer.rb'
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowedVars.
Style/FetchEnvVar:

View file

@ -141,7 +141,7 @@ module JsonLdHelper
def safe_for_forwarding?(original, compacted)
original.without('@context', 'signature').all? do |key, value|
compacted_value = compacted[key]
return false unless value.class == compacted_value.class
return false unless value.instance_of?(compacted_value.class)
if value.is_a?(Hash)
safe_for_forwarding?(value, compacted_value)

View file

@ -2,7 +2,7 @@
class ActivityPub::OutboxSerializer < ActivityPub::CollectionSerializer
def self.serializer_for(model, options)
if model.class.name == 'ActivityPub::ActivityPresenter'
if model.instance_of?(::ActivityPub::ActivityPresenter)
ActivityPub::ActivitySerializer
else
super