From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS8972 188.138.9.0/24 X-Spam-Status: No, score=-1.8 required=3.0 tests=AWL,BAYES_00,RCVD_IN_XBL shortcircuit=no autolearn=no version=3.3.2 X-Original-To: meta@public-inbox.org Received: from 80x24.org (atlantic480.us.unmetered.com [188.138.9.49]) by dcvr.yhbt.net (Postfix) with ESMTP id 84A7B200F1 for ; Fri, 4 Sep 2015 02:18:23 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/7] consolidate thread sorting in view Date: Fri, 4 Sep 2015 02:18:07 +0000 Message-Id: <1441333091-32421-4-git-send-email-e@80x24.org> In-Reply-To: <1441333091-32421-1-git-send-email-e@80x24.org> References: <1441333091-32421-1-git-send-email-e@80x24.org> List-Id: This is a display subroutine so it should not be in our thread monkey-patching package, but instead in the view package. Hopefully one day in the future, Mail::Thread will be maintained again and we'll no longer need PublicInbox::Thread at all. --- lib/PublicInbox/Thread.pm | 7 ------- lib/PublicInbox/View.pm | 9 ++++++++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/PublicInbox/Thread.pm b/lib/PublicInbox/Thread.pm index a3dedf5..781ffff 100644 --- a/lib/PublicInbox/Thread.pm +++ b/lib/PublicInbox/Thread.pm @@ -17,13 +17,6 @@ if ($Mail::Thread::VERSION <= 2.55) { eval q(sub _container_class { 'PublicInbox::Thread::Container' }); } -sub sort_ts { - sort { - (eval { $a->topmost->message->header('X-PI-TS') } || 0) <=> - (eval { $b->topmost->message->header('X-PI-TS') } || 0) - } @_; -} - package PublicInbox::Thread::Container; use strict; use warnings; diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index ee5ba20..68adbd7 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -662,7 +662,7 @@ sub thread_results { no warnings 'once'; $Mail::Thread::nosubject = $nosubject; $th->thread; - $th->order(*PublicInbox::Thread::sort_ts); + $th->order(*sort_ts); $th } @@ -747,6 +747,13 @@ sub inline_dump { inline_dump($dst, $state, $upfx, $node->next, $level); } +sub sort_ts { + sort { + (eval { $a->topmost->message->header('X-PI-TS') } || 0) <=> + (eval { $b->topmost->message->header('X-PI-TS') } || 0) + } @_; +} + sub rsort_ts { sort { (eval { $b->topmost->message->header('X-PI-TS') } || 0) <=> -- EW