Skip to content

Commit

Permalink
Fix JS error when posting from page without router context (mastodon#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored and Na0ki committed Oct 23, 2018
1 parent e7cbc73 commit e7bda0a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/javascript/mastodon/actions/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down

0 comments on commit e7bda0a

Please sign in to comment.