]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/View.pm
view: correctly pick latest in index anchor links
[public-inbox.git] / lib / PublicInbox / View.pm
index 07023e814516c40862ed32b0c2c86ebe7ba5f4db..ccdcde2a42df8515b3d2a2f69a643ea8c012b93b 100644 (file)
@@ -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;