Update shared submodule + emit post events for federation
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m18s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m18s
- Emit post.published/post.updated events from Ghost webhook sync - Updated shared with federation handlers, delivery, anchoring Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -998,8 +998,25 @@ async def sync_single_post(sess: AsyncSession, ghost_id: str) -> None:
|
|||||||
tag_obj = await _upsert_tag(sess, pt)
|
tag_obj = await _upsert_tag(sess, pt)
|
||||||
tag_map[pt["id"]] = tag_obj
|
tag_map[pt["id"]] = tag_obj
|
||||||
|
|
||||||
await _upsert_post(sess, gp, author_map, tag_map)
|
post = await _upsert_post(sess, gp, author_map, tag_map)
|
||||||
# auto-commit
|
|
||||||
|
# Emit federation event for published posts (not pages, not drafts)
|
||||||
|
if post.status == "published" and not post.is_page and post.user_id:
|
||||||
|
from shared.events import emit_event
|
||||||
|
from shared.infrastructure.urls import app_url
|
||||||
|
event_type = "post.published" if post.created_at == post.updated_at else "post.updated"
|
||||||
|
await emit_event(
|
||||||
|
sess,
|
||||||
|
event_type=event_type,
|
||||||
|
aggregate_type="Post",
|
||||||
|
aggregate_id=post.id,
|
||||||
|
payload={
|
||||||
|
"user_id": post.user_id,
|
||||||
|
"title": post.title or "",
|
||||||
|
"excerpt": post.custom_excerpt or post.excerpt or "",
|
||||||
|
"url": app_url("coop", f"/{post.slug}/"),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def sync_single_page(sess: AsyncSession, ghost_id: str) -> None:
|
async def sync_single_page(sess: AsyncSession, ghost_id: str) -> None:
|
||||||
|
|||||||
2
shared
2
shared
Submodule shared updated: 8850a0106a...dd7a99e8b7
Reference in New Issue
Block a user