fix: preserve CHRNX incomplete podcast routing
This commit is contained in:
5 files changed
+47
-9
No files matched your search
+2
-2
@@ -321,7 +321,7 @@ function chrnx_sanitize_journal_search( $value ) {
|
|||||||
*/
|
*/
|
||||||
function chrnx_get_journal_archive_filter( $queried_object = null ): array {
|
function chrnx_get_journal_archive_filter( $queried_object = null ): array {
|
||||||
$queried_object = null === $queried_object ? get_queried_object() : $queried_object;
|
$queried_object = null === $queried_object ? get_queried_object() : $queried_object;
|
||||||
if ( ! $queried_object instanceof WP_Term || ! in_array( $queried_object->taxonomy, array( 'chrnx_topic', 'chrnx_language' ), true ) ) {
|
if ( ! $queried_object instanceof WP_Term || ! in_array( $queried_object->taxonomy, array( 'chrnx_topic', 'chrnx_language', 'chrnx_show' ), true ) ) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -473,7 +473,7 @@ function chrnx_get_journal_query_args( array $request ): array {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$tax_query = array();
|
$tax_query = array();
|
||||||
foreach ( array( 'chrnx_topic', 'chrnx_language' ) as $taxonomy ) {
|
foreach ( array( 'chrnx_topic', 'chrnx_language', 'chrnx_show' ) as $taxonomy ) {
|
||||||
$value = $request[ $taxonomy ] ?? '';
|
$value = $request[ $taxonomy ] ?? '';
|
||||||
$slug = chrnx_validate_editorial_term_slug( $value, $taxonomy );
|
$slug = chrnx_validate_editorial_term_slug( $value, $taxonomy );
|
||||||
if ( '' !== $slug ) {
|
if ( '' !== $slug ) {
|
||||||
|
|||||||
@@ -96,9 +96,8 @@ test( 'long, incomplete, empty, and missing states stay usable', async ( { page
|
|||||||
} ),
|
} ),
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await expect( page.locator( '.chrnx-podcast-meta' ) ).toHaveCount( 0 );
|
await expect( page.locator( '.chrnx-podcast-meta' ) ).toHaveCount( 0 );
|
||||||
await expect( page.locator( '.taxonomy-chrnx_topic, .taxonomy-chrnx_language' ) ).toHaveCount(
|
await expect( page.locator( '.taxonomy-chrnx_topic' ) ).toContainText( 'Podcasts' );
|
||||||
0,
|
await expect( page.locator( '.taxonomy-chrnx_language' ) ).toContainText( 'Español' );
|
||||||
);
|
|
||||||
await expect( page.getByText( 'Estado de prueba para un episodio sin show' ) ).toHaveCount( 0 );
|
await expect( page.getByText( 'Estado de prueba para un episodio sin show' ) ).toHaveCount( 0 );
|
||||||
|
|
||||||
await page.goto( '/emotion-is-not-a-slider-designing-expressive-systems-that-can-hesitate/' );
|
await page.goto( '/emotion-is-not-a-slider-designing-expressive-systems-that-can-hesitate/' );
|
||||||
@@ -197,6 +196,20 @@ test( 'podcast canonical metadata is safe and missing metadata never invents a p
|
|||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
test( 'incomplete podcast remains journal-visible but excluded from show and latest surfaces', async ( {
|
||||||
|
page,
|
||||||
|
} ) => {
|
||||||
|
const title = 'Conversación pendiente de datos editoriales';
|
||||||
|
await page.goto( `/?s=${ encodeURIComponent( title ) }` );
|
||||||
|
await expect( page.locator( '.chrnx-journal-card', { hasText: title } ) ).toHaveCount( 1 );
|
||||||
|
|
||||||
|
await page.goto( '/podcasts/' );
|
||||||
|
await expect( page.locator( '.chrnx-latest-podcast', { hasText: title } ) ).toHaveCount( 0 );
|
||||||
|
|
||||||
|
await page.goto( '/show/silicon-ranch/' );
|
||||||
|
await expect( page.locator( 'main', { hasText: title } ) ).toHaveCount( 0 );
|
||||||
|
} );
|
||||||
|
|
||||||
test( 'site routes preserve heading order, named landmarks, and skip-link keyboard flow', async ( {
|
test( 'site routes preserve heading order, named landmarks, and skip-link keyboard flow', async ( {
|
||||||
page,
|
page,
|
||||||
}, testInfo ) => {
|
}, testInfo ) => {
|
||||||
|
|||||||
Vendored
+6
-4
@@ -63,7 +63,9 @@
|
|||||||
"fixtureKey": "post-podcast-missing-meta",
|
"fixtureKey": "post-podcast-missing-meta",
|
||||||
"title": "Conversación pendiente de datos editoriales",
|
"title": "Conversación pendiente de datos editoriales",
|
||||||
"content": "<!-- wp:paragraph --><p>El tema debe seguir siendo claro aunque la ficha editorial todavía esté incompleta.</p><!-- /wp:paragraph -->",
|
"content": "<!-- wp:paragraph --><p>El tema debe seguir siendo claro aunque la ficha editorial todavía esté incompleta.</p><!-- /wp:paragraph -->",
|
||||||
"fixtureStates": [ "missing-podcast-meta", "missing-excerpt", "missing-topic", "missing-language" ]
|
"topic": "podcasts",
|
||||||
|
"language": "es",
|
||||||
|
"fixtureStates": [ "missing-podcast-meta", "missing-excerpt" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fixtureKey": "post-life-fatherhood",
|
"fixtureKey": "post-life-fatherhood",
|
||||||
@@ -78,8 +80,8 @@
|
|||||||
"title": "Small interfaces, fewer lies",
|
"title": "Small interfaces, fewer lies",
|
||||||
"excerpt": "Why narrow APIs often produce software that is easier to trust and maintain.",
|
"excerpt": "Why narrow APIs often produce software that is easier to trust and maintain.",
|
||||||
"content": "<!-- wp:paragraph --><p>A public interface is a promise. Smaller promises leave less room for accidental fiction.</p><!-- /wp:paragraph -->",
|
"content": "<!-- wp:paragraph --><p>A public interface is a promise. Smaller promises leave less room for accidental fiction.</p><!-- /wp:paragraph -->",
|
||||||
"topic": "code",
|
"language": "en",
|
||||||
"language": "en"
|
"fixtureState": "missing-topic"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fixtureKey": "post-research-paper",
|
"fixtureKey": "post-research-paper",
|
||||||
@@ -87,7 +89,7 @@
|
|||||||
"excerpt": "Turning published research into experiments that can be felt, inspected, and challenged.",
|
"excerpt": "Turning published research into experiments that can be felt, inspected, and challenged.",
|
||||||
"content": "<!-- wp:paragraph --><p>Publication is not the end of an idea. It is where other people finally get a fair chance to disagree with it.</p><!-- /wp:paragraph -->",
|
"content": "<!-- wp:paragraph --><p>Publication is not the end of an idea. It is where other people finally get a fair chance to disagree with it.</p><!-- /wp:paragraph -->",
|
||||||
"topic": "research",
|
"topic": "research",
|
||||||
"language": "en"
|
"fixtureState": "missing-language"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fixtureKey": "post-gaming-accessibility",
|
"fixtureKey": "post-gaming-accessibility",
|
||||||
|
|||||||
@@ -251,6 +251,22 @@ class EditorialQueriesTest extends WP_UnitTestCase {
|
|||||||
$this->assertArrayNotHasKey( 'tax_query', chrnx_get_journal_query_args( $unsupported ) );
|
$this->assertArrayNotHasKey( 'tax_query', chrnx_get_journal_query_args( $unsupported ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Show archives constrain Journal results to actual show membership. */
|
||||||
|
public function test_show_archive_context_excludes_podcasts_without_show_membership() {
|
||||||
|
$member = $this->create_post( 'Show member', '2026-02-02 10:00:00', 'podcasts' );
|
||||||
|
$loose = $this->create_post( 'Podcast without show', '2026-02-03 10:00:00', 'podcasts' );
|
||||||
|
wp_set_object_terms( $member, 'silicon-ranch', 'chrnx_show' );
|
||||||
|
$term = get_term_by( 'slug', 'silicon-ranch', 'chrnx_show' );
|
||||||
|
$this->go_to( get_term_link( $term ) );
|
||||||
|
|
||||||
|
$context = chrnx_get_journal_request_context( array() );
|
||||||
|
$this->assertSame( 'silicon-ranch', $context['chrnx_show'] );
|
||||||
|
$ids = array_map( 'absint', wp_list_pluck( chrnx_run_eligible_query( chrnx_get_journal_query_args( $context ) )->posts, 'ID' ) );
|
||||||
|
$this->assertContains( $member, $ids );
|
||||||
|
$this->assertNotContains( $loose, $ids );
|
||||||
|
$this->go_to( '/' );
|
||||||
|
}
|
||||||
|
|
||||||
/** Malformed journal request values are ignored and never copied into query args. */
|
/** Malformed journal request values are ignored and never copied into query args. */
|
||||||
public function test_journal_query_ignores_malformed_filters_and_caps_search() {
|
public function test_journal_query_ignores_malformed_filters_and_caps_search() {
|
||||||
$args = chrnx_get_journal_query_args(
|
$args = chrnx_get_journal_query_args(
|
||||||
|
|||||||
@@ -29,6 +29,13 @@ test( 'local visual fixtures define stable pages and representative editorial st
|
|||||||
assert.ok( posts.some( ( post ) => /^https:\/\//.test( post.canonicalEpisodeUrl ?? '' ) ) );
|
assert.ok( posts.some( ( post ) => /^https:\/\//.test( post.canonicalEpisodeUrl ?? '' ) ) );
|
||||||
assert.ok( posts.some( ( post ) => hasState( post, 'missing-podcast-meta' ) && !( 'canonicalEpisodeUrl' in post ) ) );
|
assert.ok( posts.some( ( post ) => hasState( post, 'missing-podcast-meta' ) && !( 'canonicalEpisodeUrl' in post ) ) );
|
||||||
assert.equal( new Set( posts.map( ( post ) => post.fixtureKey ) ).size, posts.length );
|
assert.equal( new Set( posts.map( ( post ) => post.fixtureKey ) ).size, posts.length );
|
||||||
|
const incompletePodcast = posts.find( ( post ) => post.fixtureKey === 'post-podcast-missing-meta' );
|
||||||
|
assert.equal( incompletePodcast?.topic, 'podcasts' );
|
||||||
|
assert.equal( incompletePodcast?.language, 'es' );
|
||||||
|
assert.ok( !( 'show' in incompletePodcast ) && !( 'canonicalEpisodeUrl' in incompletePodcast ) );
|
||||||
|
assert.ok( hasState( incompletePodcast, 'missing-excerpt' ) );
|
||||||
|
assert.ok( posts.some( ( post ) => post.fixtureKey !== incompletePodcast.fixtureKey && hasState( post, 'missing-topic' ) && !( 'topic' in post ) ) );
|
||||||
|
assert.ok( posts.some( ( post ) => post.fixtureKey !== incompletePodcast.fixtureKey && hasState( post, 'missing-language' ) && !( 'language' in post ) ) );
|
||||||
for ( const topic of [ 'code', 'research', 'gaming', 'literature', 'music', 'podcasts', 'life' ] ) {
|
for ( const topic of [ 'code', 'research', 'gaming', 'literature', 'music', 'podcasts', 'life' ] ) {
|
||||||
assert.ok( posts.some( ( post ) => post.topic === topic ), `missing ${ topic } fixture` );
|
assert.ok( posts.some( ( post ) => post.topic === topic ), `missing ${ topic } fixture` );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user