summaryrefslogtreecommitdiff
path: root/lib/VNDB/DB/Discussions.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-10-08 18:16:46 +0200
committerYorhel <git@yorhel.nl>2019-10-10 16:40:30 +0200
commitb3a9130763879d60c0e413c724a759860bd396af (patch)
tree2de6f9d21d4ce9f00fc11595906570be43d8ae5c /lib/VNDB/DB/Discussions.pm
parent4c1dfc8bb62171c4c21057c47f238c8747bac3f8 (diff)
rewards: Apply supporters badge and unicode name (almost) everywhere
Only place where this isn't applied (yet?): Sorting user lists still goes by the old username and board names don't use the new unicode names. I have to say, I quite like the sql_user() and user_() pattern. It's not without problems when applied to everything, but it's good enough for several use cases.
Diffstat (limited to 'lib/VNDB/DB/Discussions.pm')
-rw-r--r--lib/VNDB/DB/Discussions.pm10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/VNDB/DB/Discussions.pm b/lib/VNDB/DB/Discussions.pm
index 6139b83b..75fb93e8 100644
--- a/lib/VNDB/DB/Discussions.pm
+++ b/lib/VNDB/DB/Discussions.pm
@@ -41,7 +41,7 @@ sub dbThreadGet {
my @select = (
qw|t.id t.title t.count t.locked t.hidden t.private|, 't.poll_question IS NOT NULL AS haspoll',
- $o{what} =~ /lastpost/ ? ('tpl.uid AS luid', q|EXTRACT('epoch' from tpl.date) AS ldate|, 'ul.username AS lusername') : (),
+ $o{what} =~ /lastpost/ ? (q|EXTRACT('epoch' from tpl.date) AS lastpost_date|, VNWeb::DB::sql_user('ul', 'lastpost_')) : (),
$o{what} =~ /poll/ ? (qw|t.poll_question t.poll_max_options t.poll_preview t.poll_recast|) : (),
);
@@ -94,12 +94,12 @@ sub dbThreadGet {
}
if($o{what} =~ /firstpost/) {
- do { my $x = $r->[$r{$_->{tid}}]; $x->{fuid} = $_->{uid}; $x->{fdate} = $_->{date}; $x->{fusername} = $_->{username} } for (@{$self->dbAll(q|
- SELECT tpf.tid, tpf.uid, EXTRACT('epoch' from tpf.date) AS date, uf.username
+ do { my $idx = $r{ delete $_->{tid} }; $r->[$idx] = { $r->[$idx]->%*, %$_ } } for (@{$self->dbAll(q|
+ SELECT tpf.tid, EXTRACT('epoch' from tpf.date) AS firstpost_date, !s
FROM threads_posts tpf
JOIN users uf ON tpf.uid = uf.id
WHERE tpf.num = 1 AND tpf.tid IN(!l)|,
- [ keys %r ]
+ VNWeb::DB::sql_user('uf', 'firstpost_'), [ keys %r ]
)});
}
@@ -237,7 +237,7 @@ sub dbPostGet {
my @select = (
qw|tp.tid tp.num tp.hidden|, q|extract('epoch' from tp.date) as date|, q|extract('epoch' from tp.edited) as edited|,
$o{search} ? () : 'tp.msg',
- $o{what} =~ /user/ ? qw|tp.uid u.username| : (),
+ $o{what} =~ /user/ ? (VNWeb::DB::sql_user()) : (),
$o{what} =~ /thread/ ? ('t.title', 't.hidden AS thread_hidden') : (),
);
my @join = (