diff options
author | Yorhel <git@yorhel.nl> | 2020-08-06 16:08:16 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2020-08-07 10:39:16 +0200 |
commit | c3a26b56d68c56ee9ffa17900fb1f1a6fcf32e26 (patch) | |
tree | 2542e1a94d317f0ae23dd90ccf928e713dbd0deb /lib/VNWeb/Discussions | |
parent | 4ff57327c4c95652c0634ca97ed5495c037fc16e (diff) |
Discussions: Fix handling of user deletion
Which I broke by removing the DEFAULT clause on threads_posts.uid. That
column still used the old uid=0 for deleted users rather than the
uid=NULL that I was planning to migrate the entire DB to. So while I'm
fixing up the threads schema, may as well update this too.
There's still a bunch of columns relying on uid=0, but I can fix that
later.
Diffstat (limited to 'lib/VNWeb/Discussions')
-rw-r--r-- | lib/VNWeb/Discussions/Lib.pm | 4 | ||||
-rw-r--r-- | lib/VNWeb/Discussions/Search.pm | 2 | ||||
-rw-r--r-- | lib/VNWeb/Discussions/Thread.pm | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/VNWeb/Discussions/Lib.pm b/lib/VNWeb/Discussions/Lib.pm index d3f3acd6..986ce90a 100644 --- a/lib/VNWeb/Discussions/Lib.pm +++ b/lib/VNWeb/Discussions/Lib.pm @@ -64,8 +64,8 @@ sub threadlist_ { FROM threads t JOIN threads_posts tf ON tf.tid = t.id AND tf.num = 1 JOIN threads_posts tl ON tl.tid = t.id AND tl.num = t.c_lastnum - JOIN users tfu ON tfu.id = tf.uid - JOIN users tlu ON tlu.id = tl.uid + LEFT JOIN users tfu ON tfu.id = tf.uid + LEFT JOIN users tlu ON tlu.id = tl.uid WHERE }, $where, q{ ORDER BY}, $opt{sort}||'tl.date DESC' ); diff --git a/lib/VNWeb/Discussions/Search.pm b/lib/VNWeb/Discussions/Search.pm index 366b3c67..3922e4e4 100644 --- a/lib/VNWeb/Discussions/Search.pm +++ b/lib/VNWeb/Discussions/Search.pm @@ -77,7 +77,7 @@ sub posts_ { q{) as headline FROM threads_posts tp JOIN threads t ON t.id = tp.tid - JOIN users u ON u.id = tp.uid + LEFT JOIN users u ON u.id = tp.uid WHERE NOT t.hidden AND NOT t.private AND NOT tp.hidden AND bb_tsvector(tp.msg) @@ to_tsquery(}, \$ts, ')', $filt->{b}->@* < keys %BOARD_TYPE ? ('AND t.id IN(SELECT tid FROM threads_boards WHERE type IN', $filt->{b}, ')') : (), q{ diff --git a/lib/VNWeb/Discussions/Thread.pm b/lib/VNWeb/Discussions/Thread.pm index 9928592f..8e443f5f 100644 --- a/lib/VNWeb/Discussions/Thread.pm +++ b/lib/VNWeb/Discussions/Thread.pm @@ -175,7 +175,7 @@ TUWF::get qr{/$RE{tid}(?:(?<sep>[\./])$RE{num})?}, sub { ',', sql_totime('tp.date'), ' as date', ',', sql_totime('tp.edited'), ' as edited FROM threads_posts tp - JOIN users u ON tp.uid = u.id + LEFT JOIN users u ON tp.uid = u.id WHERE tp.tid =', \$id, ' ORDER BY tp.num' ); |