]> Sergey Matveev's repositories - public-inbox.git/commitdiff
smsg: ->populate falls back to old {ds}/{ts} values
authorEric Wong <e@80x24.org>
Fri, 19 Aug 2022 09:07:44 +0000 (09:07 +0000)
committerEric Wong <e@80x24.org>
Fri, 19 Aug 2022 18:46:46 +0000 (18:46 +0000)
This will be useful for re-indexing external messages which
were over-indexed in lei/store.

lib/PublicInbox/Smsg.pm

index 260ce6bb065e930adfd9030d50f5a06359e809ce..2026c7d900f65c057ba4a1d8a4bea6c0c9ca400e 100644 (file)
@@ -115,8 +115,10 @@ sub populate {
                $self->{$f} = $val if $val ne '';
        }
        $sync //= {};
-       $self->{-ds} = [ my @ds = msg_datestamp($hdr, $sync->{autime}) ];
-       $self->{-ts} = [ my @ts = msg_timestamp($hdr, $sync->{cotime}) ];
+       my @ds = msg_datestamp($hdr, $sync->{autime} // $self->{ds});
+       my @ts = msg_timestamp($hdr, $sync->{cotime} // $self->{ts});
+       $self->{-ds} = \@ds;
+       $self->{-ts} = \@ts;
        $self->{ds} //= $ds[0]; # no zone
        $self->{ts} //= $ts[0];
        $self->{mid} //= mids($hdr)->[0];