Merge branch 'master' into feature/14-responsive-tables

This commit is contained in:
Justin Foell
2020-11-02 11:33:18 -06:00
2 changed files with 12 additions and 5 deletions
+7 -5
View File
@@ -136,16 +136,18 @@ class WPStrava_API {
throw WPStrava_Exception::from_wp_error( $response );
}
// Try *one* real-time token refresh if 404.
if ( $retry && 404 == $response['response']['code'] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
// Try *one* real-time token refresh if Unauthorized.
if ( $retry && 401 == $response['response']['code'] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
$retry = false;
$auth = WPStrava::get_instance()->auth;
if ( $auth instanceof WPStrava_AuthRefresh ) {
$auth->auth_refresh();
return $this->remote_get( $uri, $args );
$access_token = $this->get_access_token();
if ( $access_token ) {
$get_args['headers']['Authorization'] = 'Bearer ' . $access_token;
}
return $this->remote_get( $uri, $get_args );
}
} else {
$retry = true;
}
if ( 200 != $response['response']['code'] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
+5
View File
@@ -305,6 +305,11 @@ class WPStrava_Settings {
$input = filter_input_array( INPUT_POST, $input_args );
// All IDs have been removed.
if ( empty( $input['strava_id'] ) ) {
return array();
}
// Chop $nicknames to same size as ids.
$nicknames = array_slice( $nicknames, 0, count( $input['strava_id'] ) );