* [PATCH 4/7] view: reduce indentation for skeleton generation
2016-12-10 3:42 6% [PATCH 0/7] message threading fixes for WWW UI Eric Wong
@ 2016-12-10 3:43 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2016-12-10 3:43 UTC (permalink / raw)
To: meta
This should reduce the number of subroutine calls needed
for the common case of real (non-ghost) messages as well
as shortening code.
---
lib/PublicInbox/View.pm | 48 +++++++++++++++++++++++-------------------------
1 file changed, 23 insertions(+), 25 deletions(-)
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index feac601..c2e1ae7 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -767,8 +767,9 @@ sub _msg_date {
sub fmt_ts { POSIX::strftime('%Y-%m-%d %k:%M', gmtime($_[0])) }
-sub _skel_header {
- my ($ctx, $smsg, $level) = @_;
+sub skel_dump {
+ my ($ctx, $level, $node) = @_;
+ my $smsg = $node->{smsg} or return _skel_ghost($ctx, $level, $node);
my $dst = $ctx->{dst};
my $cur = $ctx->{cur};
@@ -824,32 +825,29 @@ sub _skel_header {
$$dst .= $d . "<a\nhref=\"$m\"$id>" . $end;
}
-sub skel_dump {
+sub _skel_ghost {
my ($ctx, $level, $node) = @_;
- if (my $smsg = $node->{smsg}) {
- _skel_header($ctx, $smsg, $level);
+
+ my $mid = $node->{id};
+ my $d = $ctx->{pct} ? ' [irrelevant] ' # search result
+ : ' [not found] ';
+ $d .= indent_for($level) . th_pfx($level);
+ my $upfx = $ctx->{-upfx};
+ my $m = PublicInbox::Hval->new_msgid($mid);
+ my $href = $upfx . $m->{href} . '/';
+ my $html = $m->as_html;
+
+ my $mapping = $ctx->{mapping};
+ my $map = $mapping->{$mid} if $mapping;
+ if ($map) {
+ my $id = id_compress($mid, 1);
+ $map->[0] = $d . qq{<<a\nhref=#r$id>$html</a>>\n};
+ $d .= qq{<<a\nhref="$href"\nid=r$id>$html</a>>\n};
} else {
- my $mid = $node->{id};
- my $dst = $ctx->{dst};
- my $d = $ctx->{pct} ? ' [irrelevant] ' # search result
- : ' [not found] ';
- $d .= indent_for($level) . th_pfx($level);
- my $upfx = $ctx->{-upfx};
- my $m = PublicInbox::Hval->new_msgid($mid);
- my $href = $upfx . $m->{href} . '/';
- my $html = $m->as_html;
-
- my $mapping = $ctx->{mapping};
- my $map = $mapping->{$mid} if $mapping;
- if ($map) {
- my $id = id_compress($mid, 1);
- $map->[0] = $d . qq{<<a\nhref=#r$id>$html</a>>\n};
- $d .= qq{<<a\nhref="$href"\nid=r$id>$html</a>>\n};
- } else {
- $d .= qq{<<a\nhref="$href">$html</a>>\n};
- }
- $$dst .= $d;
+ $d .= qq{<<a\nhref="$href">$html</a>>\n};
}
+ my $dst = $ctx->{dst};
+ $$dst .= $d;
}
sub sort_ts {
--
EW
^ permalink raw reply related [relevance 7%]
* [PATCH 0/7] message threading fixes for WWW UI
@ 2016-12-10 3:42 6% Eric Wong
2016-12-10 3:43 7% ` [PATCH 4/7] view: reduce indentation for skeleton generation Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2016-12-10 3:42 UTC (permalink / raw)
To: meta
This series improves thread handling in several oddball
cases.
In the Xapian search indexing phase, the In-Reply-To header
is always considered the last (direct) parent of a message.
This is necessary in cases where a MUA specifies References
in an invalid order. This is also what our View.pm display
has done for generating "reply" links.
Not many repos are affected by this, but
"public-inbox-index --reindex" will make those consistent
(there is no incompatible Xapian DB version bump).
We will now prune ghosts without children before display, as
they are sometimes the result of buggy (or malicious) MUAs
inserting spaces or otherwise mangling References: headers.
Ghosts with valid children remain shown, as they are likely to
be legitimate (but lost) messages.
Deploying over the next few hours, .onions first!
Currently reindexing git@vger mirror:
http://czquwvybam4bgbro.onion/meta
Up next:
http://hjrcffqmbrq6wope.onion/meta
Last: (also public-inbox.org)
http://ou63pmih66umazou.onion/meta
Eric Wong (7):
search: favor In-Reply-To over last References iff IRT exists
view: favor SearchMsg for In-Reply-To over Email::MIME
thread: fix comment describing its existence
view: reduce indentation for skeleton generation
view: skip ghosts with no direct children
thread: last Reference always wins
search: always sort thread results in ascending time order
lib/PublicInbox/Mbox.pm | 2 +-
lib/PublicInbox/Search.pm | 5 ++++
lib/PublicInbox/SearchIdx.pm | 22 ++++++++++++---
lib/PublicInbox/SearchThread.pm | 30 ++++++++++++++------
lib/PublicInbox/View.pm | 61 +++++++++++++++++++++--------------------
t/thread-cycle.t | 8 ------
6 files changed, 76 insertions(+), 52 deletions(-)
--
EW
^ 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 --
2016-12-10 3:42 6% [PATCH 0/7] message threading fixes for WWW UI Eric Wong
2016-12-10 3:43 7% ` [PATCH 4/7] view: reduce indentation for skeleton generation 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).