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 5/7] view: pre-anchor entries for flat view
  2015-09-02  6:59  6% [PATCH 0/7] improved thread views and 404 reductions Eric Wong
@ 2015-09-02  6:59  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2015-09-02  6:59 UTC (permalink / raw)
  To: meta

This will allow users to navigate the flat view without making extra
HTTP requests.
---
 lib/PublicInbox/View.pm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 0331b62..98fc133 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -167,9 +167,10 @@ sub emit_thread_html {
 	return missing_thread($cb) if $nr == 0;
 	my $flat = $ctx->{flat};
 	my $orig_cb = $cb;
+	my $seen = {};
 	my $state = {
 		ctx => $ctx,
-		seen => {},
+		seen => $seen,
 		root_anchor => anchor_for($mid),
 		anchor_idx => 0,
 	};
@@ -177,6 +178,7 @@ sub emit_thread_html {
 	require PublicInbox::GitCatFile;
 	my $git = PublicInbox::GitCatFile->new($ctx->{git_dir});
 	if ($flat) {
+		pre_anchor_entry($seen, $_) for (@$msgs);
 		__thread_entry(\$cb, $git, $state, $_, 0) for (@$msgs);
 	} else {
 		my $th = thread_results($msgs);
@@ -580,6 +582,12 @@ sub thread_html_head {
 	$$cb->write("<html><head><title>$s</title></head><body>");
 }
 
+sub pre_anchor_entry {
+	my ($seen, $mime) = @_;
+	my $id = anchor_for($mime->header('Message-ID'));
+	$seen->{$id} = "#$id"; # save the anchor for children, later
+}
+
 sub __thread_entry {
 	my ($cb, $git, $state, $mime, $level) = @_;
 
-- 
EW


^ permalink raw reply related	[relevance 7%]

* [PATCH 0/7] improved thread views and 404 reductions
@ 2015-09-02  6:59  6% Eric Wong
  2015-09-02  6:59  7% ` [PATCH 5/7] view: pre-anchor entries for flat view Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2015-09-02  6:59 UTC (permalink / raw)
  To: meta

The thread HTML view may now be flat (chronological, newest
first) to make active threads easier-to-follow.  We also make
unknown Message-IDs more usable by avoiding running SHA-1
on them.

The Message-ID finder is also handy for cross posts
and can probably link to multiple, external sources such as
mid.gmane.org and other places.

Eric Wong (7):
      view: close possible race condition in thread view
      view: optional flat view for recent messages
      view: account for missing In-Reply-To header
      view: simplify parent anchoring code
      view: pre-anchor entries for flat view
      view: avoid links to unknown compressed Message-IDs
      implement external Message-ID finder

 lib/PublicInbox/ExtMsg.pm |  92 ++++++++++++++++++++++++
 lib/PublicInbox/Hval.pm   |   4 +-
 lib/PublicInbox/View.pm   | 180 ++++++++++++++++++++++++++++++----------------
 lib/PublicInbox/WWW.pm    |  18 +++--
 public-inbox.cgi          |   1 +
 5 files changed, 226 insertions(+), 69 deletions(-)


^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-09-02  6:59  6% [PATCH 0/7] improved thread views and 404 reductions Eric Wong
2015-09-02  6:59  7% ` [PATCH 5/7] view: pre-anchor entries for flat 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).