Fix thread query

This commit is contained in:
silverpill 2021-12-02 13:38:45 +00:00
parent e43e6c3d0a
commit e4f60695d8

View file

@ -353,7 +353,7 @@ pub async fn get_thread(
WITH RECURSIVE WITH RECURSIVE
ancestors (id, in_reply_to_id) AS ( ancestors (id, in_reply_to_id) AS (
SELECT post.id, post.in_reply_to_id FROM post SELECT post.id, post.in_reply_to_id FROM post
WHERE post.id = $1 AND {condition} WHERE post.id = $1 AND ({condition})
UNION ALL UNION ALL
SELECT post.id, post.in_reply_to_id FROM post SELECT post.id, post.in_reply_to_id FROM post
JOIN ancestors ON post.id = ancestors.in_reply_to_id JOIN ancestors ON post.id = ancestors.in_reply_to_id