diff options
author | Yorhel <git@yorhel.nl> | 2021-07-19 10:45:17 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2021-07-19 10:45:17 +0200 |
commit | 2d577eb1473e9fad0761eb6a935379efb33b12fd (patch) | |
tree | 1eaa76dda99401e8ffbafea7324c9ac03b0948ce /lib/VNWeb | |
parent | 530e16818ac6652a50b9b14e10831ba833920453 (diff) |
Remove hidden items in discussion board autocomplete
Diffstat (limited to 'lib/VNWeb')
-rw-r--r-- | lib/VNWeb/Discussions/Elm.pm | 6 | ||||
-rw-r--r-- | lib/VNWeb/Discussions/Lib.pm | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/VNWeb/Discussions/Elm.pm b/lib/VNWeb/Discussions/Elm.pm index 8b39560e..e4a1c992 100644 --- a/lib/VNWeb/Discussions/Elm.pm +++ b/lib/VNWeb/Discussions/Elm.pm @@ -16,12 +16,12 @@ elm_api Boards => undef, { sql 'SELECT', $prio, ' AS prio, btype, iid, CASE WHEN iid IS NULL THEN NULL ELSE title END AS title FROM (', sql_join('UNION ALL', - sql('SELECT btype, iid, title, original FROM', sql_boards(), 'a'), - map sql('SELECT', \$_, '::board_type, NULL,', \$BOARD_TYPE{$_}{txt}, q{, ''}), + sql('SELECT btype, iid, title, original, hidden FROM', sql_boards(), 'a'), + map sql('SELECT', \$_, '::board_type, NULL,', \$BOARD_TYPE{$_}{txt}, q{, '', false}), grep !$BOARD_TYPE{$_}{dbitem} && ($BOARD_TYPE{$_}{post_perm} eq 'board' || auth->permBoardmod), keys %BOARD_TYPE ), - ') x WHERE', $where + ') x WHERE NOT x.hidden AND', $where } # This query is SLOW :( diff --git a/lib/VNWeb/Discussions/Lib.pm b/lib/VNWeb/Discussions/Lib.pm index 574c8c18..7e9465b2 100644 --- a/lib/VNWeb/Discussions/Lib.pm +++ b/lib/VNWeb/Discussions/Lib.pm @@ -20,9 +20,9 @@ sub sql_visible_threads { # Returns a SELECT subquery with all board IDs sub sql_boards { - sql q{( SELECT 'v'::board_type AS btype, id AS iid, title, original FROM vn - UNION ALL SELECT 'p'::board_type AS btype, id AS iid, name, original FROM producers - UNION ALL SELECT 'u'::board_type AS btype, id AS iid, username, NULL FROM users + sql q{( SELECT 'v'::board_type AS btype, id AS iid, title, original, hidden FROM vn + UNION ALL SELECT 'p'::board_type AS btype, id AS iid, name, original, hidden FROM producers + UNION ALL SELECT 'u'::board_type AS btype, id AS iid, username, NULL, false FROM users )} } |