]> cat aescling's git repositories - mastodon.git/commitdiff
Fix JS error when posting from page without router context (#9073)
authorEugen Rochko <eugen@zeonfederated.com>
Tue, 23 Oct 2018 23:31:31 +0000 (01:31 +0200)
committerGitHub <noreply@github.com>
Tue, 23 Oct 2018 23:31:31 +0000 (01:31 +0200)
Fix #9057

app/javascript/mastodon/actions/compose.js
app/javascript/mastodon/features/compose/components/compose_form.js

index fac8d32a12566988518abeffab6e99da3b8858ce..86d83122fc1aaab536f26aa8d7d81d202f9732a1 100644 (file)
@@ -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');
index 27178fe1981f73cbe037840db350ab93461d2394..0625ab22321a600d1da80f44384843badca67c73 100644 (file)
@@ -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 = () => {