about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchThread.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/SearchThread.pm')
-rw-r--r--lib/PublicInbox/SearchThread.pm13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/PublicInbox/SearchThread.pm b/lib/PublicInbox/SearchThread.pm
index f07dd696..00ae9fac 100644
--- a/lib/PublicInbox/SearchThread.pm
+++ b/lib/PublicInbox/SearchThread.pm
@@ -38,13 +38,13 @@ sub thread {
                 # TODO: move this to a more appropriate place, breaks tests
                 # if we do it during psgi_cull
                 delete $_->{num};
-
-                PublicInbox::SearchThread::Msg::cast($_);
+                bless $_, 'PublicInbox::SearchThread::Msg';
                 if (exists $id_table{$_->{mid}}) {
                         $_->{children} = [];
                         push @imposters, $_; # we'll deal with them later
                         undef;
                 } else {
+                        $_->{children} = {}; # will become arrayref later
                         $id_table{$_->{mid}} = $_;
                         defined($_->{references});
                 }
@@ -108,13 +108,6 @@ sub ghost {
         }, __PACKAGE__;
 }
 
-# give a existing smsg the methods of this class
-sub cast {
-        my ($smsg) = @_;
-        $smsg->{children} = {};
-        bless $smsg, __PACKAGE__;
-}
-
 sub topmost {
         my ($self) = @_;
         my @q = ($self);
@@ -174,7 +167,7 @@ sub order_children {
         while (defined($cur = shift @q)) {
                 # the {children} hashref here...
                 my @c = grep { !$seen{$_}++ && visible($_, $ibx) }
-                        values %{$cur->{children}};
+                        values %{delete $cur->{children}};
                 $ordersub->(\@c) if scalar(@c) > 1;
                 $cur->{children} = \@c; # ...becomes an arrayref
                 push @q, @c;