about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-05-23 12:55:31 +0200
committerThibaut Girka <thib@sitedethib.com>2018-05-31 14:39:02 +0200
commitf86d280fd6fb742f836e527efd3f31cf9f9eda0e (patch)
treefb74f1cf4f5a493ea6cb3ab010eb42b9df2d2471
parente396fbfe3bf4d2a404e78e73cff1a609dd0a9bfb (diff)
Use props.router instead of context.router, as we are using withRouter
-rw-r--r--app/javascript/flavours/glitch/features/ui/index.js37
1 files changed, 17 insertions, 20 deletions
diff --git a/app/javascript/flavours/glitch/features/ui/index.js b/app/javascript/flavours/glitch/features/ui/index.js
index 0e3a83bb6..756a24a76 100644
--- a/app/javascript/flavours/glitch/features/ui/index.js
+++ b/app/javascript/flavours/glitch/features/ui/index.js
@@ -99,10 +99,6 @@ const keyMap = {
 @withRouter
 export default class UI extends React.Component {
 
-  static contextTypes = {
-    router: PropTypes.object.isRequired,
-  };
-
   static propTypes = {
     dispatch: PropTypes.func.isRequired,
     children: PropTypes.node,
@@ -113,6 +109,7 @@ export default class UI extends React.Component {
     isComposing: PropTypes.bool,
     hasComposingText: PropTypes.bool,
     location: PropTypes.object,
+    router: PropTypes.object,
     intl: PropTypes.object.isRequired,
     dropdownMenuIsOpen: PropTypes.bool,
   };
@@ -200,7 +197,7 @@ export default class UI extends React.Component {
 
   handleServiceWorkerPostMessage = ({ data }) => {
     if (data.type === 'navigate') {
-      this.context.router.history.push(data.path);
+      this.props.router.history.push(data.path);
     } else {
       console.warn('Unknown message type:', data.type);
     }
@@ -306,9 +303,9 @@ export default class UI extends React.Component {
 
   handleHotkeyBack = () => {
     if (window.history && window.history.length === 1) {
-      this.context.router.history.push('/');
+      this.props.router.history.push('/');
     } else {
-      this.context.router.history.goBack();
+      this.props.router.history.goBack();
     }
   }
 
@@ -318,54 +315,54 @@ export default class UI extends React.Component {
 
   handleHotkeyToggleHelp = () => {
     if (this.props.location.pathname === '/keyboard-shortcuts') {
-      this.context.router.history.goBack();
+      this.props.router.history.goBack();
     } else {
-      this.context.router.history.push('/keyboard-shortcuts');
+      this.props.router.history.push('/keyboard-shortcuts');
     }
   }
 
   handleHotkeyGoToHome = () => {
-    this.context.router.history.push('/timelines/home');
+    this.props.router.history.push('/timelines/home');
   }
 
   handleHotkeyGoToNotifications = () => {
-    this.context.router.history.push('/notifications');
+    this.props.router.history.push('/notifications');
   }
 
   handleHotkeyGoToLocal = () => {
-    this.context.router.history.push('/timelines/public/local');
+    this.props.router.history.push('/timelines/public/local');
   }
 
   handleHotkeyGoToFederated = () => {
-    this.context.router.history.push('/timelines/public');
+    this.props.router.history.push('/timelines/public');
   }
 
   handleHotkeyGoToDirect = () => {
-    this.context.router.history.push('/timelines/direct');
+    this.props.router.history.push('/timelines/direct');
   }
 
   handleHotkeyGoToStart = () => {
-    this.context.router.history.push('/getting-started');
+    this.props.router.history.push('/getting-started');
   }
 
   handleHotkeyGoToFavourites = () => {
-    this.context.router.history.push('/favourites');
+    this.props.router.history.push('/favourites');
   }
 
   handleHotkeyGoToPinned = () => {
-    this.context.router.history.push('/pinned');
+    this.props.router.history.push('/pinned');
   }
 
   handleHotkeyGoToProfile = () => {
-    this.context.router.history.push(`/accounts/${me}`);
+    this.props.router.history.push(`/accounts/${me}`);
   }
 
   handleHotkeyGoToBlocked = () => {
-    this.context.router.history.push('/blocks');
+    this.props.router.history.push('/blocks');
   }
 
   handleHotkeyGoToMuted = () => {
-    this.context.router.history.push('/mutes');
+    this.props.router.history.push('/mutes');
   }
 
   render () {