about summary refs log tree commit homepage
path: root/lib/PublicInbox/View.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-09-01 08:55:18 +0000
committerEric Wong <e@80x24.org>2015-09-01 08:55:53 +0000
commit7bedf475e4b043870b638922a4d6ab1bd469a50b (patch)
treeb40d0fb5bf9705c7548639bc07553c25f2a7fac4 /lib/PublicInbox/View.pm
parent7c9ece10460f53e37f457e85d6d71eaa0c3c86ee (diff)
downloadpublic-inbox-7bedf475e4b043870b638922a4d6ab1bd469a50b.tar.gz
Redundant document data increases our database size, pull the
smsg->mid off the unique term, the smsg->ts off the value, and
only generate the formatted display date off smsg->ts.
Diffstat (limited to 'lib/PublicInbox/View.pm')
-rw-r--r--lib/PublicInbox/View.pm15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 584a2d70..477c4b6f 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -86,12 +86,7 @@ sub index_entry {
                 $subj = "<u\nid=\"u\">$subj</u>";
         }
 
-        my $ts = $mime->header('X-PI-TS');
-        unless (defined $ts) {
-                $ts = msg_timestamp($mime);
-        }
-        $ts = POSIX::strftime('%Y-%m-%d %H:%M', gmtime($ts));
-
+        my $ts = _msg_date($mime);
         my $rv = "<table\nsummary=l$level><tr>";
         if ($level) {
                 $rv .= '<td><pre>' . ('  ' x $level) . '</pre></td>';
@@ -561,6 +556,12 @@ sub missing_thread {
 EOF
 }
 
+sub _msg_date {
+        my ($mime) = @_;
+        my $ts = $mime->header('X-PI-TS') || msg_timestamp($mime);
+        POSIX::strftime('%Y-%m-%d %H:%M', gmtime($ts));
+}
+
 sub _inline_header {
         my ($dst, $state, $mime, $level) = @_;
         my $pfx = '  ' x $level;
@@ -568,7 +569,7 @@ sub _inline_header {
         my $cur = $state->{cur};
         my $mid = $mime->header('Message-ID');
         my $f = $mime->header('X-PI-From');
-        my $d = $mime->header('X-PI-Date');
+        my $d = _msg_date($mime);
         $f = PublicInbox::Hval->new($f);
         $d = PublicInbox::Hval->new($d);
         $f = $f->as_html;