Skip to content

Commit

Permalink
Fix Style/ClassEqualityComparison cop
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski committed May 2, 2024
1 parent 9e26001 commit a9a58f3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
8 changes: 0 additions & 8 deletions .rubocop_todo.yml
Expand Up @@ -46,14 +46,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'

Style/ClassVars:
Exclude:
- 'config/initializers/devise.rb'
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/jsonld_helper.rb
Expand Up @@ -141,7 +141,7 @@ def patch_for_forwarding!(original, compacted)
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)
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/activitypub/outbox_serializer.rb
Expand Up @@ -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
Expand Down

0 comments on commit a9a58f3

Please sign in to comment.