mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 13:14:28 +00:00
Fix typing
This commit is contained in:
parent
394dae90f5
commit
0b6556e54a
2 changed files with 9 additions and 6 deletions
|
@ -160,9 +160,9 @@ async def save_actor(db_session: AsyncSession, ap_actor: ap.RawObject) -> "Actor
|
||||||
async def fetch_actor(
|
async def fetch_actor(
|
||||||
db_session: AsyncSession,
|
db_session: AsyncSession,
|
||||||
actor_id: str,
|
actor_id: str,
|
||||||
) -> Union["ActorModel", RemoteActor]:
|
) -> "ActorModel":
|
||||||
if actor_id == LOCAL_ACTOR.ap_id:
|
if actor_id == LOCAL_ACTOR.ap_id:
|
||||||
return LOCAL_ACTOR
|
raise ValueError("local actor should not be fetched")
|
||||||
from app import models
|
from app import models
|
||||||
|
|
||||||
existing_actor = (
|
existing_actor = (
|
||||||
|
|
|
@ -7,7 +7,6 @@ import httpx
|
||||||
from bs4 import BeautifulSoup # type: ignore
|
from bs4 import BeautifulSoup # type: ignore
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from loguru import logger
|
|
||||||
from app import ap_object
|
from app import ap_object
|
||||||
from app import config
|
from app import config
|
||||||
from app.actor import LOCAL_ACTOR
|
from app.actor import LOCAL_ACTOR
|
||||||
|
@ -66,9 +65,13 @@ async def external_urls(
|
||||||
if tag_href := tag.get("href"):
|
if tag_href := tag.get("href"):
|
||||||
tags_hrefs.add(tag_href)
|
tags_hrefs.add(tag_href)
|
||||||
if tag.get("type") == "Mention":
|
if tag.get("type") == "Mention":
|
||||||
mentioned_actor = await fetch_actor(db_session, tag["href"])
|
if tag["href"] != LOCAL_ACTOR.ap_id:
|
||||||
tags_hrefs.add(mentioned_actor.url)
|
mentioned_actor = await fetch_actor(db_session, tag["href"])
|
||||||
tags_hrefs.add(mentioned_actor.ap_id)
|
tags_hrefs.add(mentioned_actor.url)
|
||||||
|
tags_hrefs.add(mentioned_actor.ap_id)
|
||||||
|
else:
|
||||||
|
tags_hrefs.add(LOCAL_ACTOR.ap_id)
|
||||||
|
tags_hrefs.add(LOCAL_ACTOR.url)
|
||||||
|
|
||||||
urls = set()
|
urls = set()
|
||||||
if ro.content:
|
if ro.content:
|
||||||
|
|
Loading…
Reference in a new issue