[fix] relates to outboxobject class
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
SouthFox 2023-04-11 23:03:53 +08:00
parent 1fb87209bb
commit 50f1595dcd
2 changed files with 13 additions and 9 deletions

View file

@ -47,8 +47,8 @@ async def get_outbox_object(
select(OutboxObject)
.where(OutboxObject.ap_id == ap_id)
.options(
joinedload(OutboxObject.relates_to_inbox_object).options(
joinedload(InboxObject.actor),
joinedload(models.OutboxObject.relates_to_inbox_object).options(
joinedload(models.InboxObject.actor),
),
)
)
@ -105,8 +105,8 @@ async def process_incoming(
def build_object(
object,
relates_to_inbox_object_id = None,
relates_to_outbox_object_id = None,
relates_to_inbox_object = None,
relates_to_outbox_object = None,
) -> InboxObject:
inbox_object = models.InboxObject(
actor_id=actor.id,
@ -119,8 +119,12 @@ async def process_incoming(
ap_object=object,
visibility=handle_visibility(object),
activity_object_ap_id=object["actor"],
relates_to_inbox_object_id=relates_to_inbox_object_id,
relates_to_outbox_object_id=relates_to_outbox_object_id,
relates_to_inbox_object_id=relates_to_inbox_object.id
if relates_to_inbox_object
else None,
relates_to_outbox_object_id=relates_to_outbox_object.id
if relates_to_outbox_object
else None,
)
return inbox_object
@ -169,8 +173,8 @@ async def process_incoming(
elif "Announce" == ap_object["type"]:
inbox_object = build_object(
ap_object,
relates_to_inbox_object_id=relates_to_inbox_object,
relates_to_outbox_object_id=relates_to_outbox_object,
relates_to_inbox_object=relates_to_inbox_object,
relates_to_outbox_object=relates_to_outbox_object,
)
db_session.add(inbox_object)
await db_session.flush()

View file

@ -137,4 +137,4 @@ def test_inbox_announce_request(
saved_note = db.execute(select(models.OutboxObject)).scalar_one()
print(saved_note.ap_id)
assert saved_note.announces_count == 0 # TODO WIP
assert saved_note.announces_count == 1 # TODO WIP