Skip to content

Commit

Permalink
dms: block command bug fix: use from user's protocol as Object.source…
Browse files Browse the repository at this point in the history
…_protocol
  • Loading branch information
snarfed committed Feb 1, 2025
1 parent ea4a537 commit 4dd9d17
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dms.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def reply(text, type=None):
return reply(f"Couldn't find {to_proto.PHRASE} user {handle}")

block_id = f'{from_user.key.id()}#bridgy-fed-block-{util.now().isoformat()}'
obj = Object(id=block_id, our_as1={
obj = Object(id=block_id, source_protocol=from_user.LABEL, our_as1={
'id': block_id,
'objectType': 'activity',
'verb': 'block',
Expand Down
9 changes: 7 additions & 2 deletions tests/test_dms.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,13 +464,18 @@ def test_receive_block(self):
self.assertEqual(('OK', 200), receive(from_user=alice, obj=obj))

self.assert_replied(OtherFake, alice, '?', ALICE_BLOCK_CONFIRMATION_CONTENT)
self.assertEqual([('other:bob:target', {

block_as1 = {
'objectType': 'activity',
'verb': 'block',
'id': 'efake:alice#bridgy-fed-block-2022-01-02T03:04:05+00:00',
'actor': 'efake:alice',
'object': 'other:bob',
})], OtherFake.sent)
}
self.assert_object(id='efake:alice#bridgy-fed-block-2022-01-02T03:04:05+00:00',
our_as1=block_as1, source_protocol='efake',
ignore=['copies'])
self.assertEqual([('other:bob:target', block_as1)], OtherFake.sent)

def test_receive_block_handle_at_symbol(self):
alice, bob = self.make_alice_bob()
Expand Down

0 comments on commit 4dd9d17

Please sign in to comment.