sensei icon indicating copy to clipboard operation
sensei copied to clipboard

Add toggle to pre-publish panel to publish lessons when course is published

Open donnapep opened this issue 1 year ago • 11 comments

Resolves #7457.

Proposed Changes

Add a Publish lessons toggle to the pre-publish panel. When enabled, any lessons associated with the course are published when the course is published.

Screenshot 2024-03-13 at 2 45 42 PM

Testing Instructions

  1. Create a course with some lessons
  2. Click the Publish button.
  3. On the pre-publish panel, ensure Publish lessons is selected.
  4. Click the Publish button.
  5. Check that the lessons are published.
  6. Create another course with some lessons.
  7. Click the Publish button.
  8. On the pre-publish panel, deselect the Publish lessons toggle.
  9. Check that the lessons are NOT published.
  10. Switch the course back to Draft status.
  11. Check that the Publish lessons toggle is still deselected.
  12. Select Publish lessons.
  13. Click the Publish button.
  14. Check that the lessons are published.
  15. Check that the Sensei icon for opening the Course Settings is still the Sensei green color.

Known Issue

The first time the course is viewed on the frontend, the following notice appears:

Screenshot 2024-03-13 at 2 37 45 PM

@renatho I know you did some work on notices not that long ago, including adding this one. Do you know of a simple way to solve this? If not, then I think I'll leave this as a known issue since the notice goes away on a refresh.

Pre-Merge Checklist

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

donnapep avatar Mar 12 '24 20:03 donnapep

WordPress Dependencies Report

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

Script Handle Added Dependencies Removed Dependencies Total Size Size Diff
js/admin/course-edit.js 10.2 kB -13 B ( -0.13% ⬇️ )
setup-wizard/index.js 16.7 kB +5 B ( +0.03% 🔼 )
home/index.js 21.1 kB +8 B ( +0.04% 🔼 )
blocks/single-page.js 15.8 kB +7 B ( +0.05% 🔼 )
blocks/single-course.js 29.1 kB +8 B ( +0.03% 🔼 )
blocks/single-lesson.js 8.05 kB +1 B ( +0.02% 🔼 )
blocks/lesson-action-blocks.js 13.6 kB +8 B ( +0.06% 🔼 )
blocks/global-blocks.js 20.5 kB +7 B ( +0.04% 🔼 )
blocks/quiz/index.js 31.2 kB +9 B ( +0.03% 🔼 )
blocks/shared.js 14 kB -2 B ( -0.02% ⬇️ )
blocks/core-pattern-polyfill/core-pattern-polyfill.js 5.02 kB -2 B ( -0.04% ⬇️ )
admin/course-pre-publish-panel/index.js react, wp-components, wp-core-data, wp-edit-post, wp-element, wp-i18n, wp-plugins, wp-polyfill 4.87 kB +4.87 kB ( +100% 🔼 )
admin/editor-wizard/index.js 13 kB +8 B ( +0.07% 🔼 )
course-theme/blocks/index.js 13.9 kB +4 B ( +0.03% 🔼 )

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

github-actions[bot] avatar Mar 12 '24 20:03 github-actions[bot]

Test the previous changes of this PR with WordPress Playground.

github-actions[bot] avatar Mar 12 '24 20:03 github-actions[bot]

Test the previous changes of this PR with WordPress Playground.

github-actions[bot] avatar Mar 12 '24 20:03 github-actions[bot]

Test the previous changes of this PR with WordPress Playground.

github-actions[bot] avatar Mar 12 '24 20:03 github-actions[bot]

Codecov Report

Attention: Patch coverage is 35.89744% with 25 lines in your changes are missing coverage. Please review.

Project coverage is 51.93%. Comparing base (9c9bcae) to head (2c5b426). Report is 24 commits behind head on trunk.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##              trunk    #7536      +/-   ##
============================================
- Coverage     51.93%   51.93%   -0.01%     
- Complexity    11267    11277      +10     
============================================
  Files           630      631       +1     
  Lines         47665    47710      +45     
  Branches        420      421       +1     
============================================
+ Hits          24756    24779      +23     
- Misses        22572    22594      +22     
  Partials        337      337              
Files Coverage Δ
includes/class-sensei-data-cleaner.php 87.75% <ø> (ø)
includes/class-sensei.php 24.94% <0.00%> (-0.06%) :arrow_down:
includes/class-sensei-course.php 38.72% <0.00%> (-0.23%) :arrow_down:
...es/admin/class-sensei-course-pre-publish-panel.php 51.85% <51.85%> (ø)

... and 3 files with indirect coverage changes


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 790e451...2c5b426. Read the comment docs.

codecov[bot] avatar Mar 12 '24 20:03 codecov[bot]

Test the previous changes of this PR with WordPress Playground.

github-actions[bot] avatar Mar 13 '24 17:03 github-actions[bot]

Test the previous changes of this PR with WordPress Playground.

github-actions[bot] avatar Mar 13 '24 17:03 github-actions[bot]

Test the previous changes of this PR with WordPress Playground.

github-actions[bot] avatar Mar 13 '24 17:03 github-actions[bot]

Test the previous changes of this PR with WordPress Playground.

github-actions[bot] avatar Mar 13 '24 17:03 github-actions[bot]

Test the previous changes of this PR with WordPress Playground.

github-actions[bot] avatar Mar 13 '24 17:03 github-actions[bot]

Test the previous changes of this PR with WordPress Playground.

github-actions[bot] avatar Mar 13 '24 18:03 github-actions[bot]

Test the previous changes of this PR with WordPress Playground.

github-actions[bot] avatar Mar 14 '24 17:03 github-actions[bot]