Protocol.receive: switch from Object.get_or_create blind put

shouldn't overwrite because we already check that we haven't seen the id before

for #1360
pull/1716/head
Ryan Barrett 2025-01-20 15:26:23 -08:00
rodzic 5603e46a48
commit 0484570fbe
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
1 zmienionych plików z 1 dodań i 5 usunięć

Wyświetl plik

@ -961,11 +961,7 @@ class Protocol:
# write Object to datastore
obj.source_protocol = from_cls.LABEL
if obj.type in STORE_AS1_TYPES:
# this is a new activity, it shouldn't have any copies yet, but check to
# be sure, since Object.to_dict flattens StructuredProperties so they
# won't work when passed to the Object constructor as kwargs
assert not obj.copies
obj = Object.get_or_create(id, authed_as=actor, **obj.to_dict())
obj.put()
# store inner object
# TODO: unify with big obj.type conditional below. would have to merge