about summary refs log tree commit diff
path: root/app/assets/javascripts/components/containers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-07 16:00:11 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-07 16:00:11 +0200
commit1f650d327d35bc48b897da99914c43750d8e5fd3 (patch)
tree6960b24e30c46c55ba9f3bf1af0a24b43cd9d248 /app/assets/javascripts/components/containers
parent06016453bd91882a53e91c11fc80f2c75fd474bb (diff)
Adding public timeline
Diffstat (limited to 'app/assets/javascripts/components/containers')
-rw-r--r--app/assets/javascripts/components/containers/mastodon.jsx18
1 files changed, 10 insertions, 8 deletions
diff --git a/app/assets/javascripts/components/containers/mastodon.jsx b/app/assets/javascripts/components/containers/mastodon.jsx
index 6c65c303b..24db6424a 100644
--- a/app/assets/javascripts/components/containers/mastodon.jsx
+++ b/app/assets/javascripts/components/containers/mastodon.jsx
@@ -18,6 +18,7 @@ import {
 import Account            from '../features/account';
 import Status             from '../features/status';
 import GettingStarted     from '../features/getting_started';
+import PublicTimeline     from '../features/public_timeline';
 import UI                 from '../features/ui';
 
 const store = configureStore();
@@ -43,14 +44,7 @@ const Mastodon = React.createClass({
     }
 
     if (typeof App !== 'undefined') {
-      App.timeline = App.cable.subscriptions.create("TimelineChannel", {
-        connected () {
-
-        },
-
-        disconnected () {
-
-        },
+      this.subscription = App.cable.subscriptions.create('TimelineChannel', {
 
         received (data) {
           switch(data.type) {
@@ -65,16 +59,24 @@ const Mastodon = React.createClass({
               return store.dispatch(refreshTimeline('mentions'));
           }
         }
+
       });
     }
   },
 
+  componentWillUnmount () {
+    if (typeof this.subscription !== 'undefined') {
+      this.subscription.unsubscribe();
+    }
+  },
+
   render () {
     return (
       <Provider store={store}>
         <Router history={hashHistory}>
           <Route path='/' component={UI}>
             <IndexRoute component={GettingStarted} />
+            <Route path='/statuses/all' component={PublicTimeline} />
             <Route path='/statuses/:statusId' component={Status} />
             <Route path='/accounts/:accountId' component={Account} />
           </Route>