kopia lustrzana https://github.com/snarfed/bridgy-fed
try not clearing Object.bsky
now that we're starting to replace copies with originals in ids, actors, etc, it'd be nice to preserve the original source object data.pull/691/head
rodzic
96b84511eb
commit
ff88c082ef
|
@ -757,7 +757,7 @@ class Object(StringIdModel):
|
|||
obj = Object(id=id)
|
||||
obj.new = True
|
||||
|
||||
if set(props.keys()) & set(('our_as1', 'as2', 'mf2', 'bsky', 'raw')):
|
||||
if set(props.keys()) & set(('our_as1', 'as2', 'mf2', 'raw')):
|
||||
obj.clear()
|
||||
obj.populate(**{
|
||||
k: v for k, v in props.items()
|
||||
|
@ -796,8 +796,11 @@ class Object(StringIdModel):
|
|||
getattr(self, prop).remove(val)
|
||||
|
||||
def clear(self):
|
||||
"""Clears all data properties."""
|
||||
for prop in 'our_as1', 'as2', 'bsky', 'mf2', 'raw':
|
||||
"""Clears all data properties.
|
||||
|
||||
TODO: remove?
|
||||
"""
|
||||
for prop in 'our_as1', 'as2', 'mf2', 'raw':
|
||||
val = getattr(self, prop, None)
|
||||
# TODO: delete entirely?
|
||||
# if val:
|
||||
|
|
|
@ -659,12 +659,11 @@ class ObjectTest(TestCase):
|
|||
|
||||
def test_clear(self):
|
||||
ab = {'a': 'b'}
|
||||
obj = Object(our_as1=ab, as2=ab, mf2=ab, bsky=ab)
|
||||
obj = Object(our_as1=ab, as2=ab, mf2=ab)
|
||||
obj.clear()
|
||||
self.assertIsNone(obj.our_as1)
|
||||
self.assertIsNone(obj.as2)
|
||||
self.assertIsNone(obj.mf2)
|
||||
self.assertIsNone(obj.bsky)
|
||||
|
||||
def test_validate_id(self):
|
||||
# DID repo ids
|
||||
|
|
Ładowanie…
Reference in New Issue