]> Sergey Matveev's repositories - public-inbox.git/commitdiff
view: fix wrong date for non-Xapian/SQLite v1 users
authorEric Wong <e@80x24.org>
Tue, 8 Jan 2019 10:30:42 +0000 (10:30 +0000)
committerEric Wong <e@80x24.org>
Tue, 8 Jan 2019 10:30:42 +0000 (10:30 +0000)
We need to parse the MIME object in order to get the
datestamp for those sites.

Fixes: 7d02b9e64455 ("view: stop storing all MIME objects on large threads")
lib/PublicInbox/View.pm
t/plack.t

index 416cb4a8001a9040afabff4ec606a2ceacb6c67b..5ddb8425029c332380447691c2fde6caf24ec477 100644 (file)
@@ -218,11 +218,12 @@ sub index_entry {
        $rv .= $subj . "\n";
        $rv .= _th_index_lite($mid_raw, \$irt, $id, $ctx);
        my @tocc;
+       my $ds = $smsg->ds; # for v1 non-Xapian/SQLite users
        my $mime = delete $smsg->{mime}; # critical to memory use
        my $hdr = $mime->header_obj;
        my $from = _hdr_names_html($hdr, 'From');
        obfuscate_addrs($obfs_ibx, $from) if $obfs_ibx;
-       $rv .= "From: $from @ ".fmt_ts($smsg->ds)." UTC";
+       $rv .= "From: $from @ ".fmt_ts($ds)." UTC";
        my $upfx = $ctx->{-upfx};
        my $mhref = $upfx . mid_escape($mid_raw) . '/';
        $rv .= qq{ (<a\nhref="$mhref">permalink</a> / };
index 9901186b7905501216d432aa68dc065ee9b835c4..2ff98e983e34527113b51a852e73aafe5c568ca8 100644 (file)
--- a/t/plack.t
+++ b/t/plack.t
@@ -46,7 +46,7 @@ To: You <you\@example.com>
 Cc: $addr
 Message-Id: <blah\@example.com>
 Subject: hihi
-Date: Thu, 01 Jan 1970 00:00:00 +0000
+Date: Fri, 02 Oct 1993 00:00:00 +0000
 
 zzzzzz
 EOF
@@ -129,6 +129,7 @@ EOF
                        'atom URL generated');
                like($res->content, qr!href="blah\@example\.com/"!,
                        'index generated');
+               like($res->content, qr!1993-10-02!, 'date set');
        });
 
        test_psgi($app, sub {