]> Sergey Matveev's repositories - public-inbox.git/commitdiff
www: remove unnecessary ghost checks
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>
Thu, 29 Mar 2018 09:57:44 +0000 (09:57 +0000)
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>
Thu, 29 Mar 2018 09:59:50 +0000 (09:59 +0000)
We do not need to care about ghosts at multiple call sites; they
cannot have a {blob} field and we've stored the blob field in
Xapian since SCHEMA_VERSION=13.

lib/PublicInbox/Inbox.pm
lib/PublicInbox/Mbox.pm
lib/PublicInbox/View.pm

index 309775146fd1b015383c462e6178650f60dad5b7..47b863094bae63964ff97afc84657473e5c8c75f 100644 (file)
@@ -270,12 +270,10 @@ sub msg_by_path ($$;$) {
 sub msg_by_smsg ($$;$) {
        my ($self, $smsg, $ref) = @_;
 
-       return unless defined $smsg; # ghost
-
-       # backwards compat to fallback to msg_by_mid
-       # TODO: remove if we bump SCHEMA_VERSION in Search.pm:
-       defined(my $blob = $smsg->{blob}) or
-                       return msg_by_path($self, mid2path($smsg->mid), $ref);
+       # ghosts may have undef smsg (from SearchThread.node) or
+       # no {blob} field (from each_smsg_by_mid)
+       return unless defined $smsg;
+       defined(my $blob = $smsg->{blob}) or return;
 
        my $str = git($self)->cat_file($blob, $ref);
        $$str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s if $str;
index c14037f4a365d31807ce730277da44ae05eb1952..381bcadad85893bb5b034911a62f374dcadbf6ec 100644 (file)
@@ -41,7 +41,6 @@ sub getline {
        }
        for (; !defined($cur) && $head != $tail; $head++) {
                my $smsg = PublicInbox::SearchMsg->get($head, $db, $ctx->{mid});
-               next if $smsg->type ne 'mail';
                my $mref = $ctx->{-inbox}->msg_by_smsg($smsg) or next;
                $cur = Email::Simple->new($mref);
                $cur = msg_str($ctx, $cur);
@@ -66,7 +65,6 @@ sub emit_raw {
                        for (; !defined($first) && $head != $tail; $head++) {
                                my @args = ($head, $db, $mid);
                                my $smsg = PublicInbox::SearchMsg->get(@args);
-                               next if $smsg->type ne 'mail';
                                my $mref = $ibx->msg_by_smsg($smsg) or next;
                                $first = Email::Simple->new($mref);
                        }
index 5fb2b31c5997da6c8750ad1372221cd44004d15f..133c30a8e517e70e879a7fc9bc9a7c252d504f77 100644 (file)
@@ -63,7 +63,6 @@ sub msg_page {
                        for (; !defined($first) && $head != $tail; $head++) {
                                my @args = ($head, $db, $mid);
                                my $smsg = PublicInbox::SearchMsg->get(@args);
-                               next if $smsg->type ne 'mail';
                                $first = $ibx->msg_by_smsg($smsg);
                        }
                        if ($head != $tail) {
@@ -85,7 +84,6 @@ sub msg_html_more {
                my $mid = $ctx->{mid};
                for (; !defined($smsg) && $head != $tail; $head++) {
                        my $m = PublicInbox::SearchMsg->get($head, $db, $mid);
-                       next if $m->type ne 'mail';
                        $smsg = $ctx->{-inbox}->smsg_mime($m);
                }
                if ($head == $tail) { # done