Improve workers for incoming/outgoing activities

This commit is contained in:
Thomas Sileo 2022-08-10 20:34:36 +02:00
parent 9d6b1e5c17
commit 8633696da0
10 changed files with 209 additions and 135 deletions

View file

@ -7,6 +7,7 @@ import httpx
from bs4 import BeautifulSoup # type: ignore
from pydantic import BaseModel
from loguru import logger
from app import ap_object
from app import config
from app.actor import LOCAL_ACTOR
@ -64,7 +65,7 @@ async def external_urls(
for tag in ro.tags:
if tag_href := tag.get("href"):
tags_hrefs.add(tag_href)
if tag.get("type") == "Mention" and tag["name"] != LOCAL_ACTOR.handle:
if tag.get("type") == "Mention":
mentioned_actor = await fetch_actor(db_session, tag["href"])
tags_hrefs.add(mentioned_actor.url)
tags_hrefs.add(mentioned_actor.ap_id)