diff --git a/models.py b/models.py index 6c17fa3..dab3590 100644 --- a/models.py +++ b/models.py @@ -761,8 +761,6 @@ class Object(StringIdModel): obj = Object(id=id) obj.new = True - if set(props.keys()) & set(('our_as1', 'as2', 'mf2', 'raw')): - obj.clear() obj.populate(**{ k: v for k, v in props.items() if v and not isinstance(getattr(Object, k), ndb.ComputedProperty) @@ -799,19 +797,6 @@ class Object(StringIdModel): with self.lock: getattr(self, prop).remove(val) - def clear(self): - """Clears all data properties. - - TODO: remove? - """ - for prop in 'our_as1', 'as2', 'mf2', 'raw': - val = getattr(self, prop, None) - # TODO: delete entirely? - # if val: - # logger.warning(f'Wiping out existing {prop}: {json_dumps(val, indent=2)}') - with self.lock: - setattr(self, prop, None) - def activity_changed(self, other_as1): """Returns True if this activity is meaningfully changed from ``other_as1``. diff --git a/protocol.py b/protocol.py index 7354802..d00a2ac 100644 --- a/protocol.py +++ b/protocol.py @@ -1128,7 +1128,6 @@ class Protocol: return obj if obj: - obj.clear() obj.new = False else: obj = Object(id=id) diff --git a/tests/test_activitypub.py b/tests/test_activitypub.py index e8b2c9e..8169e20 100644 --- a/tests/test_activitypub.py +++ b/tests/test_activitypub.py @@ -1192,7 +1192,6 @@ class ActivityPubTest(TestCase): self.assertEqual(401, resp.status_code, resp.get_data(as_text=True)) # valid signature, Object has our_as1 instead of as2 - self.key_id_obj.clear() self.key_id_obj.our_as1 = as2.to_as1(actor_as2) self.key_id_obj.put() resp = self.client.post('/ap/sharedInbox', data=body, headers=headers) diff --git a/tests/test_models.py b/tests/test_models.py index 0939b56..e7f253b 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -620,14 +620,6 @@ class ObjectTest(TestCase): self.assertNotIn('id', obj.as1['actor']) self.assertEqual(['c', 'd'], obj.as1['object']) - def test_clear(self): - ab = {'a': 'b'} - obj = Object(our_as1=ab, as2=ab, mf2=ab) - obj.clear() - self.assertIsNone(obj.our_as1) - self.assertIsNone(obj.as2) - self.assertIsNone(obj.mf2) - def test_validate_id(self): # DID repo ids Object(id='at://did:plc:123/app.bsky.feed.post/abc').put() diff --git a/tests/test_web.py b/tests/test_web.py index 180813e..ac39489 100644 --- a/tests/test_web.py +++ b/tests/test_web.py @@ -643,7 +643,7 @@ class WebTest(TestCase): source_protocol='web', type='comment', labels=[], - ignore=['our_as1'], + ignore=['our_as1', 'mf2'], ) self.assert_object('https://user.com/reply#bridgy-fed-create', source_protocol='web',