From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id ECDED1FE4E for ; Sun, 10 Jul 2016 01:24:08 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] view: conditionally anchor to thread skeleton Date: Sun, 10 Jul 2016 01:24:08 +0000 Message-Id: <20160710012408.31380-1-e@80x24.org> List-Id: We only care about the thread skeleton if we have multiple messages in a thread, single message threads can just go to the top of the message. --- lib/PublicInbox/View.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 3d6348c..4906864 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -905,11 +905,18 @@ sub dump_topics { # $n isn't the total number of posts on the topic, # just the number of posts in the current results window - $n = $n == 1 ? '' : " ($n+ messages)"; + my $anchor; + if ($n == 1) { + $n = ''; + $anchor = '#u'; # top of only message + } else { + $n = " ($n+ messages)"; + $anchor = '#t'; # thread skeleton + } my $mbox = qq(mbox.gz); my $atom = qq(Atom); - my $s = "$top\n" . + my $s = "$top\n" . " $ts UTC $n - $mbox / $atom\n"; for (my $i = 0; $i < scalar(@ex); $i += 2) { my $level = $ex[$i]; -- EW