kopia lustrzana https://github.com/snarfed/bridgy-fed
Web.send: skip polls (objectType question)
for https://console.cloud.google.com/errors/detail/CPvA_dLO4r_hIA;time=P30D;refresh=true?project=bridgy-federatedndb-global-cache
rodzic
712da61181
commit
918b2f04ee
|
@ -2927,6 +2927,20 @@ class WebUtilTest(TestCase):
|
|||
mock_get.assert_not_called()
|
||||
mock_post.assert_not_called()
|
||||
|
||||
def test_send_skips_question(self, mock_get, mock_post):
|
||||
question = {
|
||||
'type': 'Question',
|
||||
'id': 'fake:q',
|
||||
'inReplyTo': 'user.com',
|
||||
}
|
||||
|
||||
for input in (question, {'type': 'Update', 'object': question}):
|
||||
with self.subTest(input=input):
|
||||
obj = Object(id='fake:q', source_protocol='fake', as2=input)
|
||||
self.assertFalse(Web.send(obj, 'https://user.com/'))
|
||||
mock_get.assert_not_called()
|
||||
mock_post.assert_not_called()
|
||||
|
||||
def test_send_blocklisted(self, mock_get, mock_post):
|
||||
obj = Object(id='http://mas.to/like#ok', as2={
|
||||
**test_activitypub.LIKE,
|
||||
|
|
8
web.py
8
web.py
|
@ -394,10 +394,10 @@ class Web(User, Protocol):
|
|||
# we only send webmentions for responses. for sending normal posts etc
|
||||
# to followers, we just update our stored objects (elsewhere) and web
|
||||
# users consume them via feeds.
|
||||
verb = obj.as1.get('verb')
|
||||
|
||||
if verb in ('accept', 'undo'):
|
||||
logger.info(f'Skipping sending {verb} (not supported in webmention/mf2) to {url}')
|
||||
inner_type = as1.get_object(obj.as1).get('objectType') or ''
|
||||
if (obj.type in ('accept', 'question', 'undo')
|
||||
or inner_type in ('question',)):
|
||||
logger.info(f'Skipping sending {obj.type} {inner_type} (not supported in webmention/mf2) to {url}')
|
||||
return False
|
||||
|
||||
targets = as1.targets(obj.as1)
|
||||
|
|
Ładowanie…
Reference in New Issue