File tree Expand file tree Collapse file tree
assets/js/recommendations
classes/suggested-tasks/providers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 * Dependencies: progress-planner/recommendations/interactive-task
77 */
88
9- prplInteractiveTaskFormListener . siteSettings ( {
10- settingAPIKey : 'page_comments' ,
9+ prplInteractiveTaskFormListener . settings ( {
1110 setting : 'page_comments' ,
11+ settingPath : '{}' ,
1212 taskId : 'disable-comment-pagination' ,
1313 popoverId : 'prpl-popover-disable-comment-pagination' ,
14- settingCallbackValue : ( ) => '' ,
14+ settingCallbackValue : ( ) => false ,
1515} ) ;
Original file line number Diff line number Diff line change @@ -109,8 +109,7 @@ const prplInteractiveTaskFormListener = {
109109 settings : ( {
110110 taskId,
111111 setting,
112- value,
113- settingPath,
112+ settingPath = false ,
114113 popoverId,
115114 settingCallbackValue = ( settingValue ) => settingValue ,
116115 } = { } ) => {
@@ -136,7 +135,7 @@ const prplInteractiveTaskFormListener = {
136135 _ajax_nonce : progressPlanner . nonce ,
137136 post_id : taskId ,
138137 setting,
139- value,
138+ value : settingsToPass [ setting ] ,
140139 setting_path : settingPath ,
141140 } ,
142141 } ) . then ( ( ) => {
Original file line number Diff line number Diff line change @@ -33,36 +33,6 @@ class Disable_Comment_Pagination extends Tasks_Interactive {
3333 */
3434 const POPOVER_ID = 'disable-comment-pagination ' ;
3535
36- /**
37- * Initialize the task.
38- *
39- * @return void
40- */
41- public function init () {
42- \add_action ( 'rest_api_init ' , [ $ this , 'register_setting_with_rest ' ] );
43- }
44-
45- /**
46- * Register the setting with the REST API.
47- *
48- * @return void
49- */
50- public function register_setting_with_rest () {
51- register_setting (
52- 'discussion ' ,
53- 'page_comments ' ,
54- [
55- 'type ' => 'string ' ,
56- 'label ' => __ ( 'Break comments into pages ' , 'progress-planner ' ),
57- 'show_in_rest ' => [
58- 'schema ' => [
59- 'enum ' => [ '1 ' , '' ],
60- ],
61- ],
62- ]
63- );
64- }
65-
6636 /**
6737 * Get the task URL.
6838 *
Original file line number Diff line number Diff line change @@ -49,7 +49,6 @@ public function get_task_details( $task_data = [] ) {
4949 *
5050 * This is only for interactive tasks that change non-core settings.
5151 * The $_POST data is expected to be:
52- * - post_id: (int) The post ID.
5352 * - setting: (string) The setting to update.
5453 * - value: (mixed) The value to update the setting to.
5554 * - setting_path: (array) The path to the setting to update.
@@ -66,10 +65,6 @@ public function handle_interactive_task_submit() {
6665 \wp_send_json_error ( [ 'message ' => \esc_html__ ( 'Invalid nonce. ' , 'progress-planner ' ) ] );
6766 }
6867
69- if ( ! isset ( $ _POST ['post_id ' ] ) || ! isset ( $ _POST ['action_type ' ] ) ) {
70- \wp_send_json_error ( [ 'message ' => \esc_html__ ( 'Missing data. ' , 'progress-planner ' ) ] );
71- }
72-
7368 if ( ! isset ( $ _POST ['setting ' ] ) ) {
7469 \wp_send_json_error ( [ 'message ' => \esc_html__ ( 'Missing setting. ' , 'progress-planner ' ) ] );
7570 }
You can’t perform that action at this time.
0 commit comments