Skip to content
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 'Contact Teacher' and 'Conditional Content' block not appearing in site editor when Gutenberg enabled #7541

Merged

Conversation

Imran92
Copy link
Contributor

@Imran92 Imran92 commented Mar 15, 2024

Resolves issue of Contact Teacher button not appearing in site editor

Reported here 7876558-zd-a8c

Proposed Changes

Gutenberg recently added a change where it returns wp_template as current post ID in site editor instead of null when getCurrentPostType is called. So the checks that depended on this value being 'null' to detect if it's site editor, stopped working properly. This was a similar issue.

Testing Instructions

  1. Install and activate latest Gutenberg
  2. Disable Sensei Pro
  3. Go to Site Editor
  4. Open the Lesson template for Learning Mode
  5. Try finding the Contact Teacher block in the inserter, make sure it is there
  6. Try finding the 'Conditional Content' block and make sure it is there
  7. Now enable Sensei Pro
  8. Go to Site editor again
  9. Now make sure 'Contact Teacher' block is still available in the inserter but 'Conditional Content' is not
  10. Disable Gutenberg and make sure this behavior still remains

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Acceptance criteria is met
  • Decisions are publicly documented
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • New UIs match the designs
  • Different user privileges (admin, teacher, subscriber) are tested as appropriate
  • Legacy courses (course without blocks) are tested
  • Code is tested on the minimum supported PHP and WordPress versions
  • User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
  • "Needs Documentation" label is added if this change requires updates to documentation
  • Known issues are created as new GitHub issues

@Imran92 Imran92 added this to the 4.22.0 milestone Mar 15, 2024
@Imran92 Imran92 requested a review from a team March 15, 2024 13:47
@Imran92 Imran92 self-assigned this Mar 15, 2024
Copy link

WordPress Dependencies Report

The github-action-wordpress-dependencies-report action has detected some script changes between the commit 05d19fa and trunk. Please review and confirm the following are correct before merging.

Script Handle Added Dependencies Removed Dependencies Total Size Size Diff
blocks/shared.js 14 kB +10 B ( +0.08% 🔼 )

This comment was automatically generated by the github-action-wordpress-dependencies-report action.

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

codecov bot commented Mar 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.92%. Comparing base (46c9479) to head (05d19fa).
Report is 1 commits behind head on trunk.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              trunk    #7541   +/-   ##
=========================================
  Coverage     51.92%   51.92%           
  Complexity    11265    11265           
=========================================
  Files           630      630           
  Lines         47683    47683           
  Branches        421      421           
=========================================
  Hits          24759    24759           
  Misses        22587    22587           
  Partials        337      337           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3e1c326...05d19fa. Read the comment docs.

Copy link
Contributor

@renatho renatho left a comment

Choose a reason for hiding this comment

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

Thank you, @Imran92!

It looks good and works well!

I just noticed another issue in the editor while testing it, but I confirmed that it's a Gutenberg issue and opened it here: WordPress/gutenberg#59917

@donnapep
Copy link
Collaborator

@Imran92 I noticed in the screenshot from the ticket that the sensei-lms/ui block is also unsupported. Will that be fixed by this PR as well?

@Imran92
Copy link
Contributor Author

Imran92 commented Mar 18, 2024

@Imran92 I noticed in the screenshot from the ticket that the sensei-lms/ui block is also unsupported. Will that be fixed by this PR as well?

Thanks for noticing that @donnapep ! It only fixes the issue with these two blocks. After reading your comment, I did some more testing and found another issue. This happens only on WPCOM with Meraki theme when Gutenberg is activated. I've created and issue for it-

#7545

@Imran92 Imran92 merged commit 02f05ab into trunk Mar 18, 2024
26 checks passed
@Imran92 Imran92 deleted the fix/contact-teacher-and-conditional-block-not-appearing branch March 18, 2024 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants