Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/tutorial/microblog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Comment thread
DracoBlue marked this conversation as resolved.
const note = await ctx.lookupObject(post.uri);
await ctx.sendActivity(
{ identifier: username },
"followers",
Expand All @@ -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
Expand Down
Loading