Fix MultipleResultsFound crash in get_activity_for_source

- Use .scalars().first() + LIMIT 1 instead of scalar_one_or_none()
  which crashes when multiple activities exist for the same source
- Allow re-Create after Delete (re-publish after unpublish)
- Add missing on_post_unpublished handler to root shared copy
- Sync add_follower upsert fix to root shared

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-21 23:49:19 +00:00
parent 18410c4b16
commit 798fe56165
2 changed files with 10 additions and 14 deletions

View File

@@ -251,8 +251,9 @@ class SqlFederationService:
APActivity.source_type == source_type,
APActivity.source_id == source_id,
).order_by(APActivity.created_at.desc())
.limit(1)
)
).scalar_one_or_none()
).scalars().first()
return _activity_to_dto(a) if a else None
# -- Followers ------------------------------------------------------------