discourse: fix post urls

The previous code incorrectly constructed a Discourse post url based on
the post's id, rather than its index within the containing topic. This
is now fixed.

Test plan: There isn't actually a snapshot diff, because the post with
id 2 is also the second post in its thread. I'm not too worried about
this, though: this kind of code changes infrequently, and it's pretty
obvious when it's wrong.
This commit is contained in:
Dandelion Mané 2019-08-18 15:18:26 +02:00
parent c082b8faf2
commit cedc8e8fe5
1 changed files with 3 additions and 1 deletions

View File

@ -59,7 +59,9 @@ export function postNode(
post: Post,
topicTitle: string
): Node {
const url = `${serverUrl}/t/${String(post.topicId)}/${String(post.id)}`;
const url = `${serverUrl}/t/${String(post.topicId)}/${String(
post.indexWithinTopic
)}`;
const descr = `[post #${post.indexWithinTopic} on ${topicTitle}](${url})`;
const address = postAddress(serverUrl, post.id);
return {timestampMs: post.timestampMs, address, description: descr};