diff --git a/docs/tutorial/microblog.md b/docs/tutorial/microblog.md index c67840fda..9574bbf04 100644 --- a/docs/tutorial/microblog.md +++ b/docs/tutorial/microblog.md @@ -3290,11 +3290,12 @@ app.post("/users/:username/posts", async (c) => { url, post.id, ); + post.url = url; + post.uri = url; return post; })(); if (post == null) return c.text("Failed to create post", 500); - const noteArgs = { identifier: username, id: post.id.toString() }; - const note = await ctx.getObject(Note, noteArgs); + const note = await ctx.lookupObject(post.uri); await ctx.sendActivity( { identifier: username }, "followers", @@ -3306,11 +3307,11 @@ app.post("/users/:username/posts", async (c) => { ccs: note?.ccIds, }), ); - return c.redirect(ctx.getObjectUri(Note, noteArgs).href); + return c.redirect(post.url); }); ~~~~ -The `getObject()` method returns the ActivityPub object created by the object +The `lookupObject()` method returns the ActivityPub object created by the object dispatcher. Here, it will return a `Note` object. We put that `Note` object in the `object` property when creating the `Create` object. We set the `tos` (plural of `to`) and `ccs` (plural of `cc`) properties of the activity the same