Fix JS error when posting from page without router context (#9073)

Fix #9057
master
Eugen Rochko 6 years ago committed by GitHub
parent e3a1955276
commit 01c169e796
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/javascript/mastodon/actions/compose.js
  2. 2
      app/javascript/mastodon/features/compose/components/compose_form.js

@ -142,7 +142,7 @@ export function submitCompose(routerHistory) {
}
};
if (response.data.visibility === 'direct' && getState().getIn(['conversations', 'mounted']) <= 0) {
if (response.data.visibility === 'direct' && getState().getIn(['conversations', 'mounted']) <= 0 && routerHistory) {
routerHistory.push('/timelines/direct');
} else if (response.data.visibility !== 'direct') {
insertIfOnline('home');

@ -88,7 +88,7 @@ class ComposeForm extends ImmutablePureComponent {
return;
}
this.props.onSubmit(this.context.router.history);
this.props.onSubmit(this.context.router ? this.context.router.history : null);
}
onSuggestionsClearRequested = () => {

Loading…
Cancel
Save