kopia lustrzana https://github.com/snarfed/bridgy-fed
Protocol.REQUIRES_NAME: check against handle, id
rodzic
de0af66979
commit
890c7083d3
|
@ -363,8 +363,11 @@ class User(StringIdModel, metaclass=ProtocolUserMeta):
|
|||
if not self.obj or not self.obj.as1:
|
||||
return None
|
||||
|
||||
if ((self.REQUIRES_AVATAR and not self.obj.as1.get('image')) or
|
||||
(self.REQUIRES_NAME and not self.obj.as1.get('displayName'))):
|
||||
if self.REQUIRES_AVATAR and not self.obj.as1.get('image'):
|
||||
return 'blocked'
|
||||
|
||||
name = self.obj.as1.get('displayName')
|
||||
if self.REQUIRES_NAME and (not name or name in (self.handle, self.key.id())):
|
||||
return 'blocked'
|
||||
|
||||
if not as1.is_public(self.obj.as1, unlisted=False):
|
||||
|
|
|
@ -296,6 +296,12 @@ class UserTest(TestCase):
|
|||
obj_as1={'image': 'http://pic'})
|
||||
self.assertEqual('blocked', user.status)
|
||||
|
||||
user.obj.our_as1['displayName'] = 'fake:user'
|
||||
self.assertEqual('blocked', user.status)
|
||||
|
||||
user.obj.our_as1['displayName'] = 'fake:handle:user'
|
||||
self.assertEqual('blocked', user.status)
|
||||
|
||||
user.obj.our_as1['displayName'] = 'Alice'
|
||||
self.assertIsNone(user.status)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue