From 14a08b7bb56a276dc68ddc8e991151da9c85bc31 Mon Sep 17 00:00:00 2001 From: Donna Peplinskie Date: Fri, 16 Aug 2024 12:00:40 -0400 Subject: [PATCH 1/8] Revert change to quizzes --- .../class-sensei-block-quiz-question.php | 25 ++----------------- includes/blocks/class-sensei-block-quiz.php | 2 +- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/includes/blocks/class-sensei-block-quiz-question.php b/includes/blocks/class-sensei-block-quiz-question.php index 09bf3b2d15..f1d522a748 100644 --- a/includes/blocks/class-sensei-block-quiz-question.php +++ b/includes/blocks/class-sensei-block-quiz-question.php @@ -22,39 +22,18 @@ public function __construct() { Sensei_Blocks::register_sensei_block( 'sensei-lms/quiz-question', [ - 'render_callback' => '__return_empty_string', + 'render_callback' => [ $this, 'render_quiz_question' ], ], Sensei()->assets->src_path( 'blocks/quiz/question-block' ) ); - Sensei_Blocks::register_sensei_block( - 'sensei-lms/question-description', - [ - 'render_callback' => '__return_empty_string', - ], - Sensei()->assets->src_path( 'blocks/quiz/question-description-block' ) - ); - Sensei_Blocks::register_sensei_block( - 'sensei-lms/question-answers', - [ - 'render_callback' => '__return_empty_string', - ], - Sensei()->assets->src_path( 'blocks/quiz/question-answers-block' ) - ); } /** * Renders the block as an empty string. * - * @deprecated 4.24.2 - * - * @param array $attributes The block attributes. - * @param string $content The block content. - * * @return string The block HTML. */ - public function render_quiz_question( array $attributes, string $content ): string { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed - _deprecated_function( __METHOD__, '4.24.2', '__return_empty_string' ); - + public function render_quiz_question(): string { return ''; } } diff --git a/includes/blocks/class-sensei-block-quiz.php b/includes/blocks/class-sensei-block-quiz.php index bee2f7bbe2..ec7b063f10 100644 --- a/includes/blocks/class-sensei-block-quiz.php +++ b/includes/blocks/class-sensei-block-quiz.php @@ -24,7 +24,7 @@ public function __construct() { [ 'render_callback' => [ $this, 'render_quiz' ], ], - Sensei()->assets->src_path( 'blocks/quiz/quiz-block' ) + Sensei()->assets->src_path( 'blocks/quiz' ) ); } From 3c350d123dad8b8db26779addc72c18feca5360f Mon Sep 17 00:00:00 2001 From: Donna Peplinskie Date: Fri, 16 Aug 2024 12:04:05 -0400 Subject: [PATCH 2/8] Revert changes for Course Actions block --- .../class-sensei-course-actions-block.php | 26 ------------------- .../blocks/class-sensei-global-blocks.php | 1 - 2 files changed, 27 deletions(-) delete mode 100644 includes/blocks/class-sensei-course-actions-block.php diff --git a/includes/blocks/class-sensei-course-actions-block.php b/includes/blocks/class-sensei-course-actions-block.php deleted file mode 100644 index ae61b12223..0000000000 --- a/includes/blocks/class-sensei-course-actions-block.php +++ /dev/null @@ -1,26 +0,0 @@ -assets->src_path( 'blocks/course-actions-block/course-actions' ) - ); - } -} diff --git a/includes/blocks/class-sensei-global-blocks.php b/includes/blocks/class-sensei-global-blocks.php index defe1bab20..0dcd18a81a 100644 --- a/includes/blocks/class-sensei-global-blocks.php +++ b/includes/blocks/class-sensei-global-blocks.php @@ -32,7 +32,6 @@ public function initialize_blocks() { new Sensei_Course_Progress_Block(); new Sensei_Course_Overview_Block(); new Sensei_Course_List_Block(); - new Sensei_Course_Actions_Block(); } /** From 6fbe3e26eaa0985b31c32f8d842b538b4130ca33 Mon Sep 17 00:00:00 2001 From: Donna Peplinskie Date: Fri, 16 Aug 2024 12:06:30 -0400 Subject: [PATCH 3/8] Add change log entry --- changelog/revert-quiz-question-rendering | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelog/revert-quiz-question-rendering diff --git a/changelog/revert-quiz-question-rendering b/changelog/revert-quiz-question-rendering new file mode 100644 index 0000000000..8a59ffb945 --- /dev/null +++ b/changelog/revert-quiz-question-rendering @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Ensure quiz description is displayed to the student From 4482a5c8c23507ddb96ba800c0d0e0ad536fde3e Mon Sep 17 00:00:00 2001 From: Donna Peplinskie Date: Mon, 19 Aug 2024 12:10:40 -0400 Subject: [PATCH 4/8] No `render_callback` for quiz description and question answer blocks --- .../blocks/class-sensei-block-quiz-question.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/includes/blocks/class-sensei-block-quiz-question.php b/includes/blocks/class-sensei-block-quiz-question.php index f1d522a748..10acdd3781 100644 --- a/includes/blocks/class-sensei-block-quiz-question.php +++ b/includes/blocks/class-sensei-block-quiz-question.php @@ -22,10 +22,22 @@ public function __construct() { Sensei_Blocks::register_sensei_block( 'sensei-lms/quiz-question', [ - 'render_callback' => [ $this, 'render_quiz_question' ], + 'render_callback' => '__return_empty_string', ], Sensei()->assets->src_path( 'blocks/quiz/question-block' ) ); + + Sensei_Blocks::register_sensei_block( + 'sensei-lms/question-description', + [], + Sensei()->assets->src_path( 'blocks/quiz/question-description-block' ) + ); + + Sensei_Blocks::register_sensei_block( + 'sensei-lms/question-answers', + [], + Sensei()->assets->src_path( 'blocks/quiz/question-answers-block' ) + ); } /** From bd0e45ab26784843117ab988c76210b42df9bf37 Mon Sep 17 00:00:00 2001 From: Donna Peplinskie Date: Mon, 19 Aug 2024 12:13:31 -0400 Subject: [PATCH 5/8] Keep `render_quiz_question` deprecated as it's not used --- includes/blocks/class-sensei-block-quiz-question.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/includes/blocks/class-sensei-block-quiz-question.php b/includes/blocks/class-sensei-block-quiz-question.php index 10acdd3781..ab51d03cf9 100644 --- a/includes/blocks/class-sensei-block-quiz-question.php +++ b/includes/blocks/class-sensei-block-quiz-question.php @@ -43,9 +43,17 @@ public function __construct() { /** * Renders the block as an empty string. * + * @deprecated 4.24.2 + * + * @param array $attributes The block attributes. + * @param string $content The block content. + * * @return string The block HTML. */ - public function render_quiz_question(): string { + public function render_quiz_question( array $attributes, string $content ): string { + // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed + _deprecated_function( __METHOD__, '4.24.2', '__return_empty_string' ); + return ''; } } From d1399a935f7c0ec0338091ff4dc322b3c7b8065e Mon Sep 17 00:00:00 2001 From: Donna Peplinskie Date: Mon, 19 Aug 2024 12:14:55 -0400 Subject: [PATCH 6/8] Put PHPCS rule on proper line --- includes/blocks/class-sensei-block-quiz-question.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/blocks/class-sensei-block-quiz-question.php b/includes/blocks/class-sensei-block-quiz-question.php index ab51d03cf9..6167a30606 100644 --- a/includes/blocks/class-sensei-block-quiz-question.php +++ b/includes/blocks/class-sensei-block-quiz-question.php @@ -50,8 +50,7 @@ public function __construct() { * * @return string The block HTML. */ - public function render_quiz_question( array $attributes, string $content ): string { - // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed + public function render_quiz_question( array $attributes, string $content ): string { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed _deprecated_function( __METHOD__, '4.24.2', '__return_empty_string' ); return ''; From 2695fd782f0fadb2002c97e3aad8cd21832e1f3a Mon Sep 17 00:00:00 2001 From: Donna Peplinskie Date: Tue, 20 Aug 2024 07:50:58 -0400 Subject: [PATCH 7/8] Check the correct location for the block.json --- includes/blocks/class-sensei-block-quiz.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/blocks/class-sensei-block-quiz.php b/includes/blocks/class-sensei-block-quiz.php index ec7b063f10..bee2f7bbe2 100644 --- a/includes/blocks/class-sensei-block-quiz.php +++ b/includes/blocks/class-sensei-block-quiz.php @@ -24,7 +24,7 @@ public function __construct() { [ 'render_callback' => [ $this, 'render_quiz' ], ], - Sensei()->assets->src_path( 'blocks/quiz' ) + Sensei()->assets->src_path( 'blocks/quiz/quiz-block' ) ); } From 5a96809175d6e9f39770ead45ec009858179403d Mon Sep 17 00:00:00 2001 From: Donna Peplinskie Date: Tue, 20 Aug 2024 08:29:22 -0400 Subject: [PATCH 8/8] Revert unrevert of Course Actions block --- .../class-sensei-course-actions-block.php | 26 +++++++++++++++++++ .../blocks/class-sensei-global-blocks.php | 1 + 2 files changed, 27 insertions(+) create mode 100644 includes/blocks/class-sensei-course-actions-block.php diff --git a/includes/blocks/class-sensei-course-actions-block.php b/includes/blocks/class-sensei-course-actions-block.php new file mode 100644 index 0000000000..ae61b12223 --- /dev/null +++ b/includes/blocks/class-sensei-course-actions-block.php @@ -0,0 +1,26 @@ +assets->src_path( 'blocks/course-actions-block/course-actions' ) + ); + } +} diff --git a/includes/blocks/class-sensei-global-blocks.php b/includes/blocks/class-sensei-global-blocks.php index 0dcd18a81a..defe1bab20 100644 --- a/includes/blocks/class-sensei-global-blocks.php +++ b/includes/blocks/class-sensei-global-blocks.php @@ -32,6 +32,7 @@ public function initialize_blocks() { new Sensei_Course_Progress_Block(); new Sensei_Course_Overview_Block(); new Sensei_Course_List_Block(); + new Sensei_Course_Actions_Block(); } /**