about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-10-01 05:57:19 +0000
committerEric Wong <e@80x24.org>2015-10-01 05:58:06 +0000
commit6c074ee45d9948a0900ff6661d2fa3d10f2becdf (patch)
tree6e0f4082248e0f38a425d6d6ea0868fc5284c305 /lib
parente012d02ca21ddd01864c683e9cec318190abb047 (diff)
downloadpublic-inbox-6c074ee45d9948a0900ff6661d2fa3d10f2becdf.tar.gz
The last message in a thread _display_ is not necessarily the
latest message in the thread.  We must go by the Date: header
on the messages themselves as a best-guess.  Of course Date:
headers may lie, but most mail clients trust them by default,
so we will, too.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/View.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 07023e81..ccdcde2a 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -823,7 +823,10 @@ sub add_topic {
 
                 my $u = $x->header('X-PI-From');
                 my $ts = $x->header('X-PI-TS');
-                $state->{latest}->{$topic} = [ $mid, $u, $ts ];
+                my $exist = $state->{latest}->{$topic};
+                if (!$exist || $exist->[2] < $ts) {
+                        $state->{latest}->{$topic} = [ $mid, $u, $ts ];
+                }
         } else {
                 # ghost message, do not bump level
                 $child_adjust = 0;