kopia lustrzana https://github.com/snarfed/bridgy-fed
rodzic
a0f6f669b7
commit
25d2724700
15
common.py
15
common.py
|
@ -254,6 +254,21 @@ def postprocess_as2(activity, target=None, key=None):
|
|||
'Only using the first: %s' % in_reply_tos[0])
|
||||
activity['inReplyTo'] = in_reply_to[0]
|
||||
|
||||
# Mastodon evidently requires a Mention tag for replies to generate a
|
||||
# notification to the original post's author. not required for likes,
|
||||
# reposts, etc. details:
|
||||
# https://github.com/snarfed/bridgy-fed/issues/34
|
||||
to = target.get('actor') or target.get('attributedTo')
|
||||
if to:
|
||||
if isinstance(to, dict):
|
||||
to = to.get('url') or to.get('id')
|
||||
if to:
|
||||
activity.setdefault('tag', []).append({
|
||||
'type': 'Mention',
|
||||
'href': to,
|
||||
})
|
||||
|
||||
|
||||
# activity objects (for Like, Announce, etc): prefer id over url
|
||||
obj = activity.get('object', {})
|
||||
if obj:
|
||||
|
|
|
@ -175,6 +175,10 @@ class WebmentionTest(testutil.TestCase):
|
|||
'preferredUsername': 'orig',
|
||||
'name': 'Ms. ☕ Baz',
|
||||
}],
|
||||
'tag': [{
|
||||
'type': 'Mention',
|
||||
'href': 'http://orig/author',
|
||||
}],
|
||||
},
|
||||
}
|
||||
self.as2_update = copy.deepcopy(self.as2_create)
|
||||
|
@ -503,4 +507,3 @@ class WebmentionTest(testutil.TestCase):
|
|||
self.assertIn('Target post http://orig/url has no Atom link', got.body)
|
||||
|
||||
self.assertIsNone(Response.get_by_id('http://a/reply http://orig/post'))
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue