Skip to content

Commit

Permalink
#540 - Reset authentication flag if credentials for TTS cannot be ver…
Browse files Browse the repository at this point in the history
…ified. Make TTS 5.7 compatible.
  • Loading branch information
joshuaabenazer committed Aug 1, 2023
1 parent c91f826 commit ca275e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions includes/Classifai/Providers/Azure/TextToSpeech.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public function setup_fields_sections() {
'label_for' => 'post_types',
'option_index' => 'post_types',
'options' => $this->get_post_types_select_options(),
'default_values' => $default_settings['post-types'],
'default_values' => $default_settings['post_types'],
]
);

Expand Down Expand Up @@ -238,6 +238,9 @@ public function sanitize_settings( $settings ) {

if ( ! empty( $current_settings['voices'] ) ) {
$current_settings['authenticated'] = true;
} else {
$current_settings['voices'] = [];
$current_settings['authenticated'] = false;
}
}
} else {
Expand Down Expand Up @@ -434,7 +437,7 @@ public function get_default_settings() {
'voices' => array(),
'voice' => '',
'authenticated' => false,
'post-types' => array(),
'post_types' => array(),
];
}

Expand Down
3 changes: 2 additions & 1 deletion src/js/gutenberg-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ const ClassifAITTS = () => {
// Post type label.
const postTypeLabel = useSelect(
( select ) =>
select( 'core/editor' ).getPostTypeLabel() ||
( typeof select( 'core/editor' ).getPostTypeLabel !== 'undefined' &&
select( 'core/editor' ).getPostTypeLabel() ) ||
__( 'Post', 'classifai' )
);

Expand Down

0 comments on commit ca275e3

Please sign in to comment.