Skip to content

Commit

Permalink
MM-4887: Remove back to MM button for Zapier-MM OAuth integration set…
Browse files Browse the repository at this point in the history
…up (mattermost#4906)

* MM-4887: Remove back to MM button got Zapier OAuth setup

* MM-4887: Fix lint error

Co-authored-by: Catalin Tomai <[email protected]>
  • Loading branch information
catalintomai and catalintomai committed Mar 30, 2020
1 parent 987045a commit 4c08988
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ exports[`components/error_page/ErrorMessage should match snapshot, oauth_access_
</p>
`;

exports[`components/error_page/ErrorMessage should match snapshot, oauth_invalid_param type 1`] = `
<p>
error message
</p>
`;

exports[`components/error_page/ErrorMessage should match snapshot, oauth_missing_code type 1`] = `
<div>
<p>
Expand Down
8 changes: 8 additions & 0 deletions components/error_page/__snapshots__/error_title.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ exports[`components/error_page/ErrorTitle should match snapshot, oauth_missing_c
/>
`;

exports[`components/error_page/ErrorTitle should match snapshot, oauth_invalid_param type 1`] = `
<FormattedMessage
defaultMessage="OAuth Parameter Error"
id="error.oauth_invalid_param.title"
values={Object {}}
/>
`;

exports[`components/error_page/ErrorTitle should match snapshot, page_not_found type 1`] = `
<FormattedMessage
defaultMessage="Page Not Found"
Expand Down
9 changes: 9 additions & 0 deletions components/error_page/error_message.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ describe('components/error_page/ErrorMessage', () => {
expect(wrapper).toMatchSnapshot();
});

test('should match snapshot, oauth_invalid_param type', () => {
const props = {...baseProps, type: ErrorPageTypes.OAUTH_INVALID_PARAM, message: 'error message'};
const wrapper = shallow(
<ErrorMessage {...props}/>
);

expect(wrapper).toMatchSnapshot();
});

test('should match snapshot, page_not_found type', () => {
const props = {...baseProps, type: ErrorPageTypes.PAGE_NOT_FOUND};
const wrapper = shallow(
Expand Down
7 changes: 7 additions & 0 deletions components/error_page/error_message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,13 @@ const ErrorMessage: React.FC<Props> = ({type, message, service, isGuest}: Props)
</p>
);
break;
case ErrorPageTypes.OAUTH_INVALID_PARAM:
errorMessage = (
<p>
{message}
</p>
);
break;
case ErrorPageTypes.PAGE_NOT_FOUND:
default:
errorMessage = (
Expand Down
2 changes: 2 additions & 0 deletions components/error_page/error_page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ export default class ErrorPage extends React.PureComponent<Props> {
/>
</Link>
);
} else if (type === ErrorPageTypes.OAUTH_INVALID_PARAM) {
backButton = null;
} else {
backButton = (
<Link to='/'>
Expand Down
9 changes: 9 additions & 0 deletions components/error_page/error_title.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ describe('components/error_page/ErrorTitle', () => {
expect(wrapper).toMatchSnapshot();
});

test('should match snapshot, oauth_invalid_param type', () => {
const props = {...baseProps, type: ErrorPageTypes.OAUTH_INVALID_PARAM};
const wrapper = shallow(
<ErrorTitle {...props}/>
);

expect(wrapper).toMatchSnapshot();
});

test('should match snapshot, page_not_found type', () => {
const props = {...baseProps, type: ErrorPageTypes.PAGE_NOT_FOUND};
const wrapper = shallow(
Expand Down
8 changes: 8 additions & 0 deletions components/error_page/error_title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ const ErrorTitle: React.FC<Props> = ({type, title}: Props) => {
/>
);
break;
case ErrorPageTypes.OAUTH_INVALID_PARAM:
errorTitle = (
<FormattedMessage
id='error.oauth_invalid_param.title'
defaultMessage='OAuth Parameter Error'
/>
);
break;
case ErrorPageTypes.TEAM_NOT_FOUND:
errorTitle = (
<FormattedMessage
Expand Down
1 change: 1 addition & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2293,6 +2293,7 @@
"error.not_found.title": "Page Not Found",
"error.oauth_access_denied": "You must authorize Mattermost to log in with {service}.",
"error.oauth_access_denied.title": "Authorization Error",
"error.oauth_invalid_param.title": "OAuth Parameter Error",
"error.oauth_missing_code": "The service provider {service} did not provide an authorization code in the redirect URL.",
"error.oauth_missing_code.forum": "If you reviewed the above and are still having trouble with configuration, you may post in our {link} where we'll be happy to help with issues during setup.",
"error.oauth_missing_code.forum.link": "Troubleshooting forum",
Expand Down
1 change: 1 addition & 0 deletions utils/constants.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ export const ErrorPageTypes = {
LOCAL_STORAGE: 'local_storage',
OAUTH_ACCESS_DENIED: 'oauth_access_denied',
OAUTH_MISSING_CODE: 'oauth_missing_code',
OAUTH_INVALID_PARAM: 'oauth_invalid_param',
PAGE_NOT_FOUND: 'page_not_found',
PERMALINK_NOT_FOUND: 'permalink_not_found',
TEAM_NOT_FOUND: 'team_not_found',
Expand Down

0 comments on commit 4c08988

Please sign in to comment.