tchCommentsDescendantsDB
    :: [CommentId]
    -> ExprCommentCond
    -> DB [Entity Comment]
fetchCommentsDescendantsDB comment_ids has_permission =
    select $
    from $ \c -> do
    where_ $
        c ^. CommentId `in_`
            subList_select (querCommentsDescendants comment_ids)
        &&. has_permission c
    -- DO NOT change ordering here! buildCommentTree relies on it.
    orderBy [asc (c ^. CommentParent), asc (c ^. CommentCreatedTs)]
    return c

-- | Given a list of candidate CommentIds, return only those that have any
-- (possibly not visible) children.
f
fetchCommentsDescendantsDB
    :: [CommentId]
    -> ExprCommentCond
    -> DB [Entity Comment]
fetchCommentsDescendantsDB comment_ids has_permission =
    select $
    from $ \c -> do
    where_ $
        c ^. CommentId `in_`
            subList_select (querCommentsDescendants comment_ids)
        &&. has_permission c
    -- DO NOT change ordering here! buildCommentTree relies on it.
    orderBy [asc (c ^. CommentParent), asc (c ^. CommentCreatedTs)]
    return c

-- | Given a list of candidate CommentIds, return only those that have any
-- (possibly not visible) children.
fetchCommentsDescendantsDB comment_ids has_permission =
    select $
    from $ \c -> do
    where_ $
        c ^. CommentId `in_`
            subList_select (querCommentsDescendants comment_ids)
        &&. has_permission c
    -- DO NOT change ordering here! buildCommentTree relies on it.
    orderBy [asc (c ^. CommentParent), asc (c ^. CommentCreatedTs)]
    return c

-- | Given a list of candidate CommentIds, return only those that have any
-- (possibly not visible) children.