* [PATCH 0/2] www: link to new topics_*.html pages
@ 2024-01-23 22:08 Eric Wong
2024-01-23 22:08 ` [PATCH 1/2] www_topics: simplify date column mapping Eric Wong
2024-01-23 22:09 ` [PATCH 2/2] view: /$INBOX/ links to topics_{new,active}.html Eric Wong
0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2024-01-23 22:08 UTC (permalink / raw)
To: meta
1/2 is a small code simplification I noticed (how tf did
I not do it originally?!)
2/2 actually adds links to the new pages from the /$INBOX_NAME
landing page
Eric Wong (2):
www_topics: simplify date column mapping
view: /$INBOX/ links to topics_{new,active}.html
lib/PublicInbox/View.pm | 6 +++++-
lib/PublicInbox/WwwTopics.pm | 5 ++---
2 files changed, 7 insertions(+), 4 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] www_topics: simplify date column mapping
2024-01-23 22:08 [PATCH 0/2] www: link to new topics_*.html pages Eric Wong
@ 2024-01-23 22:08 ` Eric Wong
2024-01-23 22:09 ` [PATCH 2/2] view: /$INBOX/ links to topics_{new,active}.html Eric Wong
1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2024-01-23 22:08 UTC (permalink / raw)
To: meta
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{ <a\nhref="}.mid_href($smsg->{mid}).qq{/#r">$s</a>};
my $nr = $smsg->{'COUNT(num)'};
$_[0] .= " $nr+ messages" if $nr > 1;
@@ -29,7 +29,7 @@ EOS
sub topics_active ($) {
$_[0]->do_get(<<EOS);
-SELECT ddd,MAX(ds),COUNT(num) FROM over WHERE tid IN
+SELECT ddd,MAX(ds) as ds,COUNT(num) FROM over WHERE tid IN
(SELECT DISTINCT(tid) FROM over WHERE tid > 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);
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] view: /$INBOX/ links to topics_{new,active}.html
2024-01-23 22:08 [PATCH 0/2] www: link to new topics_*.html pages Eric Wong
2024-01-23 22:08 ` [PATCH 1/2] www_topics: simplify date column mapping Eric Wong
@ 2024-01-23 22:09 ` Eric Wong
1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2024-01-23 22:09 UTC (permalink / raw)
To: meta
This makes the new endpoints easier-to-find. The navigation is
still at the bottom of the page since I figured having it at the
top is too cluttered for users on small terminals.
---
lib/PublicInbox/View.pm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 9d4262c1..697535ff 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -1201,7 +1201,11 @@ sub pagination_footer ($$) {
$next = $next ? "$next | " : ' | ';
$prev .= qq[ | <a\nhref="$latest">latest</a>];
}
- ($next || $prev) ? "<hr><pre id=nav>page: $next$prev</pre>" : '';
+ my $rv = '<hr><pre id=nav>';
+ $rv .= "page: $next$prev\n" if $next || $prev;
+ $rv .= q{- recent:[<b>subjects (threaded)</b>|<a
+href="./topics_new.html">topics (new)</a>|<a
+href="./topics_active.html">topics (active)</a>]</pre>};
}
sub paginate_recent ($$) {
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-23 22:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-23 22:08 [PATCH 0/2] www: link to new topics_*.html pages Eric Wong
2024-01-23 22:08 ` [PATCH 1/2] www_topics: simplify date column mapping Eric Wong
2024-01-23 22:09 ` [PATCH 2/2] view: /$INBOX/ links to topics_{new,active}.html Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).