Skip to content

Commit

Permalink
AP users: minor tweak, include full @context in indirect users' actors
Browse files Browse the repository at this point in the history
for #512
  • Loading branch information
snarfed committed Jun 4, 2023
1 parent fe27742 commit 47b3dd2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion activitypub.py
Expand Up @@ -550,7 +550,11 @@ def actor(protocol, domain):
g.user = cls.get_or_create(id=domain, actor_as2=actor_as2)

# TODO: unify with common.actor()
actor = postprocess_as2(g.user.actor_as2 or {'type': 'Person'})
actor = g.user.actor_as2 or {
'@context': [as2.CONTEXT],
'type': 'Person',
}
actor = postprocess_as2(actor)
actor.update({
'id': g.user.ap_actor(),
# This has to be the domain for Mastodon etc interop! It seems like it
Expand Down
5 changes: 4 additions & 1 deletion tests/test_activitypub.py
Expand Up @@ -304,7 +304,10 @@ def test_actor_fake(self, *_):
type = got.headers['Content-Type']
self.assertTrue(type.startswith(as2.CONTENT_TYPE), type)
self.assertEqual({
'@context': ['https://w3id.org/security/v1'],
'@context': [
'https://www.w3.org/ns/activitystreams',
'https://w3id.org/security/v1',
],
'type': 'Person',
'id': 'http://bf/fake.com/ap',
'preferredUsername': 'fake.com',
Expand Down

0 comments on commit 47b3dd2

Please sign in to comment.