mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 05:04:27 +00:00
Fix processing for forwarded transient activities
This commit is contained in:
parent
3af56bf2dc
commit
a006ba2cc4
2 changed files with 7 additions and 1 deletions
|
@ -240,7 +240,7 @@ def object_visibility(ap_activity: RawObject, actor: "Actor") -> VisibilityEnum:
|
|||
|
||||
|
||||
def get_actor_id(activity: RawObject) -> str:
|
||||
if activity["type"] in ["Note", "Article", "Video", "Question", "Page"]:
|
||||
if "attributedTo" in activity:
|
||||
attributed_to = as_list(activity["attributedTo"])
|
||||
return get_id(attributed_to[0])
|
||||
else:
|
||||
|
|
|
@ -1239,6 +1239,12 @@ async def save_to_inbox(
|
|||
except Exception:
|
||||
raise fastapi.HTTPException(status_code=401, detail="Invalid LD sig")
|
||||
|
||||
# Transient activities from Mastodon like Like are not fetchable and
|
||||
# will return the actor instead
|
||||
if raw_object["id"] != raw_object_id:
|
||||
logger.info(f"Unable to fetch {raw_object_id}")
|
||||
return None
|
||||
|
||||
if (
|
||||
await db_session.scalar(
|
||||
select(func.count(models.InboxObject.id)).where(
|
||||
|
|
Loading…
Reference in a new issue