fix: comment thread paths are inaccurate

This commit is contained in:
James Xylight committed 2025-08-08 14:22:29 -07:00
1 parent d839724a33
commit 671908f40d
4 files changed
+67 -43

No files matched your search

+14 -1
View File
@@ -14,8 +14,21 @@ export async function load({ params, fetch }) {
id: Number(params.id),
})
const split = comment.comment_view.comment.path.split('.')
const threadPath =
split.length > 4
? comment.comment_view.comment.id
: split.slice(-5).join('.')
redirect(
302,
`/post/${profile.current.instance}/${comment.comment_view.post.id}?thread=${comment.comment_view.comment.path}#${comment.comment_view.comment.id}`,
resolveRoute(
`/post/[instance]/[id]?thread=${threadPath}#${comment.comment_view.comment.id}`,
{
instance: params.instance,
id: comment.comment_view.post.id.toString(),
},
),
)
}