refactor/process boxes
This commit is contained in:
parent
cde57f2604
commit
0ff423cf9b
1 changed files with 10 additions and 5 deletions
13
app/boxes.py
13
app/boxes.py
|
@ -37,7 +37,9 @@ async def save_incoming(
|
|||
ap_object=payload,
|
||||
)
|
||||
await process_incoming(db_session, payload)
|
||||
db_session.add(incoming_activity)
|
||||
if db_session.add(incoming_activity):
|
||||
return incoming_activity
|
||||
|
||||
await db_session.commit()
|
||||
await db_session.refresh(incoming_activity)
|
||||
return incoming_activity
|
||||
|
@ -52,21 +54,24 @@ async def process_incoming(
|
|||
await _handle_follow(db_session, ap_object)
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
async def _handle_follow(
|
||||
db_session: AsyncSession,
|
||||
ap_object: dict,
|
||||
) -> None:
|
||||
) -> bool:
|
||||
if ME["id"] != ap_object["object"]:
|
||||
# await db_session.delete(ap_object)
|
||||
logger.warning("no match follow object!" + ap_object["object"])
|
||||
return
|
||||
return False
|
||||
|
||||
if MANUALLY_APPROVES_FOLLOWERS:
|
||||
# TODO
|
||||
return
|
||||
return False
|
||||
|
||||
await _send_accept(db_session, ap_object)
|
||||
return True
|
||||
|
||||
|
||||
async def _send_accept(
|
||||
|
|
Loading…
Reference in a new issue