Skip to content

Commit

Permalink
Update blog example
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Jul 2, 2024
1 parent f9fc578 commit cb85193
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/blog/federation/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,12 @@ federation.setInboxListeners("/users/{handle}/inbox", "/inbox")
published: create.published ?? Temporal.Now.instant(),
};
// Filters only `Note` objects that are in reply to posts in this blog:
const urlPattern = new URLPattern("/posts/:uuid", ctx.url.href);
for (const replyTargetId of object.replyTargetIds) {
const match = urlPattern.exec(replyTargetId);
if (match == null) continue;
const postUuid = match.pathname.groups.uuid;
if (postUuid == null) continue;
const parsed = ctx.parseUri(replyTargetId);
if (
parsed == null || parsed.type !== "object" || parsed.class !== Article
) continue;
const postUuid = parsed.values.uuid;
await addComment({ ...comment, postUuid });
}
} else {
Expand Down

0 comments on commit cb85193

Please sign in to comment.