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

Add hook to conditionally show the lesson actions block in the frontend #7677

Merged
merged 9 commits into from
Oct 30, 2024

Conversation

Imran92
Copy link
Contributor

@Imran92 Imran92 commented Sep 4, 2024

Resolves https://github.com/Automattic/sensei-pro/issues/1956 (partial)

Proposed Changes

We've added a hook here which will allow us to conditionally render the lesson actions block in the frontend from elsewhere (i.e. Sensei-pro)

Testing Instructions

  1. Follow the instructions in - https://github.com/Automattic/sensei-pro/pull/2607

New/Updated Hooks

  • sensei_lesson_show_actions - Flag to show or hide the lesson actions block in the frontend.

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 the Hooks This change adds or modifies one or more hooks. label Sep 4, 2024
@Imran92 Imran92 added this to the 4.24.4 milestone Sep 4, 2024
@Imran92 Imran92 self-assigned this Sep 4, 2024
Copy link

github-actions bot commented Sep 4, 2024

Test the previous changes of this PR with WordPress Playground.

@Imran92 Imran92 requested a review from a team September 4, 2024 16:17
@Imran92 Imran92 marked this pull request as ready for review September 4, 2024 16:17
@@ -1358,6 +1358,21 @@ public function testShouldShowLessonActions_WhenPrerequisiteFoundAndWasNotLesson
self::assertFalse( $result );
}

public function testShouldShowLessonActions_WhenHookSetsFalce_ReturnsFalse(): void {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This test case name is somewhat misleading. In particular, the WhenHookSetsFalse part because in this test case we're testing both true and false. We could split these into 2 separate use cases to test each since there isn't much repetitive setup code.

donnapep
donnapep previously approved these changes Sep 5, 2024
Copy link
Collaborator

@donnapep donnapep left a comment

Choose a reason for hiding this comment

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

Looks good. I added a small comment about the tests though.

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

Test the previous changes of this PR with WordPress Playground.

@Imran92
Copy link
Contributor Author

Imran92 commented Oct 29, 2024

Looks good. I added a small comment about the tests though.

Thanks @donnapep ! I've updated it here 438d8ca . Can you kindly take a look again? Thanks!

Copy link
Collaborator

@donnapep donnapep left a comment

Choose a reason for hiding this comment

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

🚀

@Imran92 Imran92 merged commit 1217402 into trunk Oct 30, 2024
22 checks passed
@Imran92 Imran92 deleted the fix/prevent-rendering-lesson-actions-in-content-drip branch October 30, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hooks This change adds or modifies one or more hooks.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants