From 36aec198989f5b5bfa665e26f7f014c7ba6c7948 Mon Sep 17 00:00:00 2001 From: Asaf Gartner Date: Sat, 6 Jul 2024 10:46:56 +0300 Subject: [PATCH] Actually correct grouping of ANDs and ORs in the SQL --- src/hmndata/timeline_helper.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hmndata/timeline_helper.go b/src/hmndata/timeline_helper.go index 90d28218..2bb139cd 100644 --- a/src/hmndata/timeline_helper.go +++ b/src/hmndata/timeline_helper.go @@ -141,13 +141,13 @@ func FetchTimeline( JOIN project ON project.id = post.project_id WHERE post.deleted = false AND thread.deleted = false - AND $? = true OR project.id = $? OR ( + AND ($? = true OR project.id = $? OR ( project.lifecycle = ANY($?) AND NOT project.hidden AND (SELECT bool_or(user_project.user_id = $?) OR bool_and(hmn_user.status = $?) FROM user_project JOIN hmn_user ON hmn_user.id = user_project.user_id WHERE user_project.project_id = project.id) = true - ) + )) `, currentUserIsAdmin, models.HMNProjectID,