Compare commits
1 Commits
24432cd52a
...
1d83a339b6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d83a339b6 |
@@ -286,6 +286,23 @@ class SqlFederationService:
|
||||
if actor is None:
|
||||
raise ValueError(f"Actor not found: {username}")
|
||||
|
||||
# Upsert: update if already following, insert if new
|
||||
existing = (
|
||||
await session.execute(
|
||||
select(APFollower).where(
|
||||
APFollower.actor_profile_id == actor.id,
|
||||
APFollower.follower_acct == follower_acct,
|
||||
)
|
||||
)
|
||||
).scalar_one_or_none()
|
||||
|
||||
if existing:
|
||||
existing.follower_inbox = follower_inbox
|
||||
existing.follower_actor_url = follower_actor_url
|
||||
existing.follower_public_key = follower_public_key
|
||||
await session.flush()
|
||||
return _follower_to_dto(existing)
|
||||
|
||||
follower = APFollower(
|
||||
actor_profile_id=actor.id,
|
||||
follower_acct=follower_acct,
|
||||
|
||||
Reference in New Issue
Block a user