From 13f19ce67e4c641405828fa16e563e3fbf6b8eb9 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 23 Jan 2024 22:08:59 +0000 Subject: www_topics: simplify date column mapping We can rely on SQLite to map `MAX(ds)' to `ds' rather than doing it in Perl, reducing the size of our Perl optree at the (smaller) expense of SQLite bytecode. --- lib/PublicInbox/WwwTopics.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/WwwTopics.pm b/lib/PublicInbox/WwwTopics.pm index ad85a46d..9d270732 100644 --- a/lib/PublicInbox/WwwTopics.pm +++ b/lib/PublicInbox/WwwTopics.pm @@ -9,7 +9,7 @@ sub add_topic_html ($$) { my (undef, $smsg) = @_; my $s = ascii_html($smsg->{subject}); $s = '(no subject)' if $s eq ''; - $_[0] .= "\n".fmt_ts($smsg->{'MAX(ds)'} // $smsg->{ds}) . + $_[0] .= "\n".fmt_ts($smsg->{ds}) . qq{ {mid}).qq{/#r">$s}; my $nr = $smsg->{'COUNT(num)'}; $_[0] .= " $nr+ messages" if $nr > 1; @@ -29,7 +29,7 @@ EOS sub topics_active ($) { $_[0]->do_get(< 0 ORDER BY ts DESC LIMIT 200) AND +num > 0 GROUP BY tid @@ -43,7 +43,6 @@ sub topics_atom { # GET /$INBOX_NAME/topics_(new|active).atom my ($ctx) = @_; require PublicInbox::WwwAtomStream; my ($hdr, $smsg, $val); - $_->{ds} //= $_->{'MAX(ds)'} // 0 for @{$ctx->{msgs}}; PublicInbox::WwwAtomStream->response($ctx, \&topics_i); } -- cgit v1.2.3-24-ge0c7