0
0
Fork 0

Fix ActivityPub context not being dynamically computed (#11746)

* Fix contexts not being dynamically included

Fixes #11649

* Refactor Note context in serializer

* Refactor Actor serializer
This commit is contained in:
ThibG 2019-09-03 22:52:32 +02:00 committed by Eugen Rochko
parent ec1dd865fb
commit 692c5b439a
6 changed files with 24 additions and 29 deletions

View file

@ -27,4 +27,12 @@ class ActivityPub::Serializer < ActiveModel::Serializer
_context_extensions[extension_name] = true
end
end
def serializable_hash(adapter_options = nil, options = {}, adapter_instance = self.class.serialization_adapter_instance)
unless adapter_options&.fetch(:named_contexts, nil).nil?
adapter_options[:named_contexts].merge!(_named_contexts)
adapter_options[:context_extensions].merge!(_context_extensions)
end
super(adapter_options, options, adapter_instance)
end
end