Skip to content

CMM-2466: Hide the auto-generated Reader excerpt for <br> posts - #23405

Merged
nbradbury merged 4 commits into
trunkfrom
issue/CMM-2466-reader-detail-excerpt
Oct 9, 2026
Merged

nbradbury merged 4 commits into
trunkfrom
issue/CMM-2466-reader-detail-excerpt

Conversation

@nbradbury

@nbradbury nbradbury commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR

Fixes CMM-2466

In Reader post detail, posts written with Shift+Enter line breaks (<br>) and no manual excerpt showed their whole text twice: once as the grey excerpt under the header, then as the content. This PR makes the auto-excerpt check ignore whitespace so that excerpt is hidden again.

Before and After

before

Description

Fixes CMM-2466.

  • isAutoGeneratedExcerpt hides an excerpt when the stripped post content starts with it.
  • WordPress builds the auto-excerpt by stripping tags, which drops <br> with no space (thatthe). HtmlUtils.fastStripHtml turns <br> into a newline, which then became a space (that the), so startsWith failed and the excerpt was treated as author-written.
  • Both sides now have all whitespace removed before comparing, instead of collapsing it to single spaces. It can only hide an excerpt that matches the start of the post once whitespace is ignored, and that's the case the check already meant to hide.
  • Adds ReaderPostDetailsHeaderViewUiStateBuilderTest (the builder had no tests): an excerpt generated from <br> posts is hidden, and an author-written excerpt is still shown.

The post from the original report now has a manual excerpt (.), so it can't be used to verify the fix. Use a test post instead.

Testing instructions

  1. On a WP.com site, set Settings → Reading → "For each post in a feed, include" to Full text. With Excerpt, the Reader API returns the excerpt as the post content and the bug can't reproduce.
  2. Create a short post (under 55 words) as a single paragraph with Shift+Enter line breaks, and leave Excerpt empty.
  3. Open the post in the Jetpack Reader (pull to refresh first if it was already cached).
  • Only the post content is shown, with no grey excerpt under the header. On trunk, the excerpt repeats the post with words run together.

…eaks

The server drops <br> with no space when building the excerpt, while fastStripHtml turns it into whitespace, so the "content starts with excerpt" check failed and the excerpt was shown.
@dangermattic

dangermattic commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@wpmobilebot

wpmobilebot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in WordPress Android by scanning the QR code below to install the corresponding build.

App NameWordPress Android
Build TypeDebug
Versionpr23405-cf87f37
Build Number1498
Application IDorg.wordpress.android.prealpha
Commitcf87f37
Installation URL1ko2jouaj124g
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in Jetpack Android by scanning the QR code below to install the corresponding build.

App NameJetpack Android
Build TypeDebug
Versionpr23405-cf87f37
Build Number1498
Application IDcom.jetpack.android.prealpha
Commitcf87f37
Installation URL0275559rkovsg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

This comment was marked as resolved.

Mocking the data class tripped the DoNotMockDataClass lint check.
@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.64%. Comparing base (6875444) to head (cf87f37).

Files with missing lines Patch % Lines
...views/ReaderPostDetailsHeaderViewUiStateBuilder.kt 0.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #23405      +/-   ##
==========================================
+ Coverage   38.62%   38.64%   +0.02%     
==========================================
  Files        2301     2301              
  Lines      128055   128054       -1     
  Branches    18124    18123       -1     
==========================================
+ Hits        49460    49492      +32     
+ Misses      74494    74442      -52     
- Partials     4101     4120      +19     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nbradbury
nbradbury marked this pull request as ready for review October 8, 2026 18:32
@nbradbury
nbradbury requested a review from dcalhoun October 8, 2026 18:32
@nbradbury
nbradbury requested a review from adalpari October 9, 2026 11:00

@dcalhoun dcalhoun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested well. 🚀

@nbradbury
nbradbury merged commit 3703978 into trunk Oct 9, 2026
23 checks passed
@nbradbury
nbradbury deleted the issue/CMM-2466-reader-detail-excerpt branch October 9, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants