Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Peter Wilson <[email protected]>
  • Loading branch information
theskinnyghost and peterwilsoncc authored Oct 10, 2023
1 parent 2794487 commit 020ef2d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion assets/js/admin-external-connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ function checkConnections() {
} else if (
response.data.errors.no_external_connection ||
'no' === response.data.is_authenticated ||
response.data.errors.no_distributor
response.data.errors.no_distributor ||
! response.data.can_post.length
) {
endpointResult.setAttribute( 'data-endpoint-state', 'error' );

Expand Down Expand Up @@ -353,6 +354,21 @@ function checkConnections() {
),
'polite'
);
} else if (
'no' === response.data.is_authenticated ||
response.data.errors.no_types
) {
endpointResult.innerText = __(
'Authentication failed due to insufficient or invalid credentials.',
'distributor'
);
speak(
__(
'Authentication failed due to insufficient or invalid credentials.',
'distributor'
),
'polite'
);
} else {
endpointResult.innerText = __(
'No connection found.',
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/e2e/external-connection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe( 'Admin can add a new external connection', () => {
);
cy.get( '.endpoint-result' ).should(
'contain.text',
'No connection found'
'Authentication failed due to insufficient or invalid credentials.'
);
} );
} );

0 comments on commit 020ef2d

Please sign in to comment.