user/dev discussion of public-inbox itself
 help / color / Atom feed
* [PATCH 0/2] view: two display fixes for deduped subjects
@ 2020-04-22  1:33 Kyle Meyer
  2020-04-22  1:33 ` [PATCH 1/2] view: strip omission character from current message in thread view Kyle Meyer
  2020-04-22  1:33 ` [PATCH 2/2] view: actually omit subject text when dumping topics Kyle Meyer
  0 siblings, 2 replies; 5+ messages in thread
From: Kyle Meyer @ 2020-04-22  1:33 UTC (permalink / raw)
  To: meta; +Cc: Kyle Meyer

Looking at a thread on https://public-inbox.org/meta/ today, I got
confused by what a stray " was doing after a subject.  Poking around,
it seems the omission character is getting tacked on despite the
entire subject being displayed.

As I was locally debugging/testing my fix for that issue, I noticed "
popping up in a spot that it shouldn't, the line for the current
message in the thread overview shown at the top of a message.


  [1/2] view: strip omission character from current message in thread view
  [2/2] view: actually omit subject text when dumping topics

 lib/PublicInbox/View.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


base-commit: 2289dc4ab72cb31475039e26cb10786e6bf573d2
-- 
2.26.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] view: strip omission character from current message in thread view
  2020-04-22  1:33 [PATCH 0/2] view: two display fixes for deduped subjects Kyle Meyer
@ 2020-04-22  1:33 ` Kyle Meyer
  2020-04-22  7:01   ` Eric Wong
  2020-04-22  1:33 ` [PATCH 2/2] view: actually omit subject text when dumping topics Kyle Meyer
  1 sibling, 1 reply; 5+ messages in thread
From: Kyle Meyer @ 2020-04-22  1:33 UTC (permalink / raw)
  To: meta; +Cc: Kyle Meyer

In the thread view shown at the top of a message, the subject for the
current message is dropped, leaving just the sender's name.  However,
if skel_dump() omitted part of the subject because it was duplicated,
the omission character is still displayed:

  * [PATCH v2] t/www_listing: avoid 'once' warnings
    2020-03-21  1:10 ` [PATCH 2/2] t/www_listing: avoid 'once' warnings Eric Wong
  @ 2020-03-21  5:24   ` " Eric Wong

Note the " on the last line.

Adjust the regular expression in _th_index_lite() to account for the
omission character.
---
 lib/PublicInbox/View.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 9b62ed3c..c90eaf6a 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -322,7 +322,7 @@ sub _th_index_lite {
 	my $s_s = nr_to_s($nr_s, 'sibling', 'siblings');
 	my $s_c = nr_to_s($nr_c, 'reply', 'replies');
 	$attr =~ s!\n\z!</b>\n!s;
-	$attr =~ s!<a\nhref.*</a> !!s; # no point in duplicating subject
+	$attr =~ s!<a\nhref.*</a> (&#34; )?!!s; # no point in duplicating subject
 	$attr =~ s!<a\nhref=[^>]+>([^<]+)</a>!$1!s; # no point linking to self
 	$rv .= "<b>@ $attr";
 	if ($nr_c) {
-- 
2.26.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] view: actually omit subject text when dumping topics
  2020-04-22  1:33 [PATCH 0/2] view: two display fixes for deduped subjects Kyle Meyer
  2020-04-22  1:33 ` [PATCH 1/2] view: strip omission character from current message in thread view Kyle Meyer
@ 2020-04-22  1:33 ` Kyle Meyer
  1 sibling, 0 replies; 5+ messages in thread
From: Kyle Meyer @ 2020-04-22  1:33 UTC (permalink / raw)
  To: meta; +Cc: Kyle Meyer

Despite dump_topics() calling dedupe_subject() on the subject, the
index shows partly duplicated subjects, for example

  ` [PATCH 2/2] t/www_listing: avoid 'once' warnings
    ` [PATCH v2] t/www_listing: avoid 'once' warnings "

In the second line, the omission character " is appended, but the
entire subject is shown.  To display the subject with duplicated parts
omitted, regenerate it from the array that is modified by
dedupe_subject().
---
 lib/PublicInbox/View.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index c90eaf6a..30928fdb 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -1096,6 +1096,7 @@ sub dump_topics {
 			my @next_prev = @subj; # full copy
 			my $omit = dedupe_subject($prev_subj, \@subj, ' &#34;');
 			$prev_subj = \@next_prev;
+			$subj = join(' ', @subj);
 			$subj = ascii_html($subj);
 			obfuscate_addrs($obfs_ibx, $subj) if $obfs_ibx;
 			$href = mid_href($mid);
-- 
2.26.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] view: strip omission character from current message in thread view
  2020-04-22  1:33 ` [PATCH 1/2] view: strip omission character from current message in thread view Kyle Meyer
@ 2020-04-22  7:01   ` Eric Wong
  2020-04-22 15:44     ` Kyle Meyer
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Wong @ 2020-04-22  7:01 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: meta

Kyle Meyer <kyle@kyleam.com> wrote:

Thanks for this series (and for figuring out how some of this
code works :)

> +++ b/lib/PublicInbox/View.pm
> @@ -322,7 +322,7 @@ sub _th_index_lite {
>  	my $s_s = nr_to_s($nr_s, 'sibling', 'siblings');
>  	my $s_c = nr_to_s($nr_c, 'reply', 'replies');
>  	$attr =~ s!\n\z!</b>\n!s;
> -	$attr =~ s!<a\nhref.*</a> !!s; # no point in duplicating subject
> +	$attr =~ s!<a\nhref.*</a> (&#34; )?!!s; # no point in duplicating subject

PATCH 2/2 looked fine, some minor nits on this one:

1) use `?:' when you don't intend to use $1 before the next RE match.
   `?:' avoids a small amount of overhead for saving $1.

2) line exceeds 80 columns, I just shortened "duplicating" to "dup"
   (I like really big fonts)

Will squash this in before pushing:

diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 30928fdb..5144a130 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -322,7 +322,7 @@ sub _th_index_lite {
 	my $s_s = nr_to_s($nr_s, 'sibling', 'siblings');
 	my $s_c = nr_to_s($nr_c, 'reply', 'replies');
 	$attr =~ s!\n\z!</b>\n!s;
-	$attr =~ s!<a\nhref.*</a> (&#34; )?!!s; # no point in duplicating subject
+	$attr =~ s!<a\nhref.*</a> (?:&#34; )?!!s; # no point in dup subject
 	$attr =~ s!<a\nhref=[^>]+>([^<]+)</a>!$1!s; # no point linking to self
 	$rv .= "<b>@ $attr";
 	if ($nr_c) {

Thanks again.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] view: strip omission character from current message in thread view
  2020-04-22  7:01   ` Eric Wong
@ 2020-04-22 15:44     ` Kyle Meyer
  0 siblings, 0 replies; 5+ messages in thread
From: Kyle Meyer @ 2020-04-22 15:44 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta

Eric Wong <e@yhbt.net> writes:

> PATCH 2/2 looked fine, some minor nits on this one:
[...]
> Will squash this in before pushing:

Thanks for the review and fixups.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22  1:33 [PATCH 0/2] view: two display fixes for deduped subjects Kyle Meyer
2020-04-22  1:33 ` [PATCH 1/2] view: strip omission character from current message in thread view Kyle Meyer
2020-04-22  7:01   ` Eric Wong
2020-04-22 15:44     ` Kyle Meyer
2020-04-22  1:33 ` [PATCH 2/2] view: actually omit subject text when dumping topics Kyle Meyer

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror http://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git