-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix duplicate comment section under lesson in FSE themes #7044
Conversation
Codecov Report
@@ Coverage Diff @@
## trunk #7044 +/- ##
=========================================
Coverage 48.02% 48.03%
- Complexity 10458 10465 +7
=========================================
Files 573 573
Lines 44145 44151 +6
Branches 402 402
=========================================
+ Hits 21201 21207 +6
Misses 22617 22617
Partials 327 327
Continue to review full report in Codecov by Sentry.
|
Wow, excellent detective work! 🔍 We should also test on unsupported themes to ensure comments still behave as before, correct? |
Looks like that as the call is now conditional. Do you know an example of an unsupported theme? :) |
Yup, any theme for which we don't provide a custom wrapper and that doesn't explicitly declare Sensei support (e.g. Divi and Astra). More details here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great investigation!
Left a few suggestions for tests.
includes/unsupported-theme-handlers/class-sensei-unsupported-theme-handler-cpt.php
Outdated
Show resolved
Hide resolved
Thanks for the review @merkushin ! I've updated the test names and have split the act and assertions here b35c319.
Also looks like it's working as expected for Course, Divi and Astra, so it's working in our popular themes. I've also checked using them. And as you've said, design of the comment section is not in the scope of this PR. But for the Course theme, we're fixing all the comment stylings under this card Automattic/themes#6977. Please do take a look again when possible. Thanks! |
Thanks @donnapep ! <3 It was fun! Yap, we should check. I checked with our top popular themes to see if it's working as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from my perspective, but I'll leave final approval to @merkushin to ensure his comments are addressed to his satisfaction. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Imran! Checked with the updated course theme, looks good :)
Resolves #7037
Proposed Changes
In FSE themes, like Course, Twenty Twenty Three etc, we were seeing two comment sections. After some investigation, we understood that one of them (the one at the bottom) was coming from the
page
template of those themes (It also turned out it's not using the right template, so we created another issue for it). So this was the expected one, but the top one was unexpected.We found that there are some custom processes in place for lesson post type, there we manually call the comments_template function on a hook. But as the deprecation hook messages suggest in linked code, that there is no comments.php template available for the theme, which is expected. But it was still echoing comments. Looking deeper, we found out that it uses a fallback default template from the compat folder in core even if it doesn't find any template in the theme, as it comes from core, they don't follow any design from our block theme's comment section. So we made calling the function conditional for non FSE themes.
Doing the above was rendering single comment section only from the FSE theme's page template as expected, but the comment reply form was still not loading. Digging into that, we found that for all unsupported themes (every block theme), we're disabling comments using a hook here and here. So we made them conditional for FSE as well.
Testing Instructions
Sensei LMS -> Settings -> Appearance
.Pre-Merge Checklist