fix: Filter by deleted when querying workspaces (#4512)

Fixes #4508.
This commit is contained in:
Kyle Carberry authored and GitHub committed 2022-10-12 14:53:03 -05:00
1 parent 0fa8f528c2
commit 0d0ea981da
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -109,7 +109,7 @@ WHERE
-- Filter by owner_name
AND CASE
WHEN @owner_username :: text != '' THEN
owner_id = (SELECT id FROM users WHERE lower(username) = lower(@owner_username))
owner_id = (SELECT id FROM users WHERE lower(username) = lower(@owner_username) AND deleted = false)
ELSE true
END
-- Filter by template_name
@@ -117,7 +117,7 @@ WHERE
-- Use the organization filter to restrict to 1 org if needed.
AND CASE
WHEN @template_name :: text != '' THEN
template_id = ANY(SELECT id FROM templates WHERE lower(name) = lower(@template_name))
template_id = ANY(SELECT id FROM templates WHERE lower(name) = lower(@template_name) AND deleted = false)
ELSE true
END
-- Filter by template_ids