kopia lustrzana https://github.com/snarfed/bridgy-fed
when replying to Follow with Accept, include original Follow object verbatim
notably, including id. fixes #522 (again)pull/530/head
rodzic
368c5b26aa
commit
6e834713f1
|
@ -284,11 +284,7 @@ class Protocol:
|
||||||
'id': common.host_url(f'/user/{g.user.key.id()}/followers#accept-{obj.key.id()}'),
|
'id': common.host_url(f'/user/{g.user.key.id()}/followers#accept-{obj.key.id()}'),
|
||||||
'type': 'Accept',
|
'type': 'Accept',
|
||||||
'actor': followee_actor_url,
|
'actor': followee_actor_url,
|
||||||
'object': {
|
'object': as2.from_as1(obj.as1),
|
||||||
'type': 'Follow',
|
|
||||||
'actor': follower_id,
|
|
||||||
'object': followee_actor_url,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return cls.send(Object(as2=accept), inbox)
|
return cls.send(Object(as2=accept), inbox)
|
||||||
|
|
||||||
|
|
|
@ -153,15 +153,17 @@ FOLLOW_WRAPPED_WITH_ACTOR['actor'] = ACTOR
|
||||||
FOLLOW_WITH_OBJECT = copy.deepcopy(FOLLOW)
|
FOLLOW_WITH_OBJECT = copy.deepcopy(FOLLOW)
|
||||||
FOLLOW_WITH_OBJECT['object'] = ACTOR
|
FOLLOW_WITH_OBJECT['object'] = ACTOR
|
||||||
|
|
||||||
|
ACCEPT_FOLLOW = copy.deepcopy(FOLLOW_WITH_ACTOR)
|
||||||
|
del ACCEPT_FOLLOW['actor']['@context']
|
||||||
|
ACCEPT_FOLLOW['actor']['image'] = {'type': 'Image', 'url': 'https://user.com/me.jpg'}
|
||||||
ACCEPT = {
|
ACCEPT = {
|
||||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||||
'type': 'Accept',
|
'type': 'Accept',
|
||||||
'id': 'http://localhost/user/user.com/followers#accept-https://mas.to/6d1a',
|
'id': 'http://localhost/user/user.com/followers#accept-https://mas.to/6d1a',
|
||||||
'actor': 'http://localhost/user.com',
|
'actor': 'http://localhost/user.com',
|
||||||
'object': {
|
'object': {
|
||||||
'type': 'Follow',
|
**ACCEPT_FOLLOW,
|
||||||
'actor': 'https://mas.to/users/swentel',
|
'url': 'https://mas.to/users/swentel#followed-https://user.com/',
|
||||||
'object': 'http://localhost/user.com',
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -648,13 +650,14 @@ class ActivityPubTest(TestCase):
|
||||||
'id': FOLLOW['object'],
|
'id': FOLLOW['object'],
|
||||||
'url': FOLLOW['object'],
|
'url': FOLLOW['object'],
|
||||||
}
|
}
|
||||||
|
|
||||||
follow = {
|
follow = {
|
||||||
**FOLLOW,
|
**FOLLOW,
|
||||||
'object': unwrapped_user,
|
'object': unwrapped_user,
|
||||||
}
|
}
|
||||||
|
accept = copy.deepcopy(ACCEPT)
|
||||||
|
accept['object']['object'] = unwrapped_user
|
||||||
|
|
||||||
self._test_inbox_follow_accept(follow, ACCEPT, *mocks)
|
self._test_inbox_follow_accept(follow, accept, *mocks)
|
||||||
|
|
||||||
follower = Follower.query().get()
|
follower = Follower.query().get()
|
||||||
follow.update({
|
follow.update({
|
||||||
|
|
Ładowanie…
Reference in New Issue