user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 3/7] consolidate thread sorting in view
  @ 2015-09-04  2:18  7% ` Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2015-09-04  2:18 UTC (permalink / raw)
  To: meta

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


^ permalink raw reply related	[relevance 7%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-09-04  2:18     [PATCH 0/7] new index and misc fixes Eric Wong
2015-09-04  2:18  7% ` [PATCH 3/7] consolidate thread sorting in view Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).