fix(submissions): walk the polylang group when checking submitter meta#230
Conversation
cdcf_is_public_submission() resolved its post to "the EN sibling" via
cdcf_get_source_post_id() and read submitter meta from there. For a
non-English public submission the meta lives on the originally-submitted
post (the language the human used), and the auto-translated EN sibling
has no meta — so the gate returned false for every sibling whose own
post lacked the meta. cdcf_link_referral_on_publish then bailed and the
sibling was never appended to its language's projects page
community_projects relationship field.
Now walks pll_get_post_translations() for the entire group and returns
true if ANY sibling carries _submission_submitter_email or
_referral_submitter_email. Falls back to a single-post check when
Polylang is missing or the post is in no group.
Production trigger 2026-06-16: community_project 1534 ("Enciclopedia
Católica") submitted in Spanish. ES sibling 1534 carried the referral
meta and was appended to /es/proyectos. EN sibling 1556 (and IT/FR/PT/DE)
got auto-translated and worker-promoted to publish, but the publish hook
saw no meta on the EN-resolved post and bailed — so the encyclopedia
never appeared on /projects, /it/progetti, /fr/projets, /pt/projetos,
/de/projekte.
Replaces the old test_is_public_submission_resolves_translation_to_source_via_polylang
with test_is_public_submission_true_when_any_sibling_in_the_polylang_group_carries_submitter_meta
covering the production scenario (ES carries meta, called with the EN
sibling, also with another non-source sibling, also with the source
itself). The three legacy single-post tests gain a pll_get_post_translations
stub that returns an empty group, exercising the new fallback path.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesPolylang Group Traversal for Public Submission Check
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 6 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
cdcf_is_public_submission()to walkpll_get_post_translations()and return true if ANY sibling carries_submission_submitter_emailor_referral_submitter_email. The old shape resolved to "the EN sibling" viacdcf_get_source_post_id()and only read meta there — which fails for non-English public submissions, where the meta lives on the originally-submitted post (the language the human used) and the auto-translated EN sibling has none.test_is_public_submission_resolves_translation_to_source_via_polylangwithtest_is_public_submission_true_when_any_sibling_in_the_polylang_group_carries_submitter_metacovering the production scenario (ES carries meta, called with the EN sibling, with another non-source sibling, and with the source itself). Three legacy single-post tests gain apll_get_post_translationsstub that returns[]so they exercise the new fallback path.Production trigger
community_project1534 ("Enciclopedia Católica") was submitted in Spanish; the ES post carried the referral meta and thecdcf_link_referral_on_publishhook correctly appended 1534 to/es/proyectos. But when the worker auto-translated and promoted siblings 1552–1556 (it/fr/pt/de/en) to publish, the hook re-fired for each — andcdcf_is_public_submissionwalked to the EN sibling (1556), found no meta there, and bailed. Result: the encyclopedia was invisible on/projects,/it/progetti,/fr/projets,/pt/projetos,/de/projekte. Manual recovery viaupdate-relationshipon pages 6/86/88/89/90 unblocked production; this PR closes the gap so the next non-English referral surfaces automatically.Test plan
composer test --working-dir=wordpress/themes/cdcf-headless— 579/579 passgh workflow run deploy.yml -f environment=production, then verify by re-running the worker (or by adding a fresh test referral in a non-English language) that the matching-language projects page picks up the post automatically🤖 Generated with Claude Code
Summary by CodeRabbit