accept Undo of Follow even if Follower doesn't exist

pull/59/head
Ryan Barrett 2019-08-01 07:39:01 -07:00
rodzic f02c212f37
commit 65044b081c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
2 zmienionych plików z 7 dodań i 7 usunięć

Wyświetl plik

@ -214,12 +214,13 @@ class InboxHandler(webapp2.RequestHandler):
# deactivate Follower
user_domain = util.domain_from_link(followee)
follower_obj = Follower.get_by_id(Follower._id(user_domain, follower))
if not follower_obj:
common.error(self, '%s has never followed %s' % (follower, user_domain))
if follower_obj:
logging.info('Marking %s as inactive' % follower_obj.key)
follower_obj.status = 'inactive'
follower_obj.put()
else:
logging.warning(self, 'No Follower found for %s %s' % (user_domain, follower))
logging.info('Marking %s as inactive' % follower_obj.key)
follower_obj.status = 'inactive'
follower_obj.put()
# TODO send webmention with 410 of u-follow

Wyświetl plik

@ -375,8 +375,7 @@ class ActivityPubTest(testutil.TestCase):
got = app.get_response('/foo.com/inbox', method='POST',
body=json.dumps(UNDO_FOLLOW_WRAPPED))
self.assertEquals(400, got.status_int)
self.assertIn('has never followed realize.be', got.text)
self.assertEquals(200, got.status_int)
def test_inbox_undo_follow_inactive(self, mock_head, mock_get, mock_post):
mock_head.return_value = requests_response(url='https://realize.be/')