about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-10 00:47:47 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-10 00:47:47 +0100
commitbf5f55a6bbfee69e41acfcd14002308c69d8b68c (patch)
tree9261287b4c47c3a88c7c30a5e355b50ae9cfa9fe /app
parentaabf884c5f6bf5c0a7cdec2c3e4fe174eeecfaec (diff)
Fix live status removal from public/hashtag channels
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/components/features/hashtag_timeline/index.jsx10
-rw-r--r--app/assets/javascripts/components/features/public_timeline/index.jsx18
-rw-r--r--app/services/fan_out_on_write_service.rb4
3 files changed, 22 insertions, 10 deletions
diff --git a/app/assets/javascripts/components/features/hashtag_timeline/index.jsx b/app/assets/javascripts/components/features/hashtag_timeline/index.jsx
index de6a9618e..bea0a2759 100644
--- a/app/assets/javascripts/components/features/hashtag_timeline/index.jsx
+++ b/app/assets/javascripts/components/features/hashtag_timeline/index.jsx
@@ -4,7 +4,8 @@ import StatusListContainer from '../ui/containers/status_list_container';
 import Column from '../ui/components/column';
 import {
   refreshTimeline,
-  updateTimeline
+  updateTimeline,
+  deleteFromTimelines
 } from '../../actions/timelines';
 
 const HashtagTimeline = React.createClass({
@@ -24,7 +25,12 @@ const HashtagTimeline = React.createClass({
       }, {
 
         received (data) {
-          dispatch(updateTimeline('tag', JSON.parse(data.message)));
+          switch(data.type) {
+            case 'update':
+              return dispatch(updateTimeline('tag', JSON.parse(data.message)));
+            case 'delete':
+              return dispatch(deleteFromTimelines(data.id));
+          }
         }
 
       });
diff --git a/app/assets/javascripts/components/features/public_timeline/index.jsx b/app/assets/javascripts/components/features/public_timeline/index.jsx
index 8b2a86947..12f73ba9b 100644
--- a/app/assets/javascripts/components/features/public_timeline/index.jsx
+++ b/app/assets/javascripts/components/features/public_timeline/index.jsx
@@ -1,11 +1,12 @@
-import { connect }         from 'react-redux';
-import PureRenderMixin     from 'react-addons-pure-render-mixin';
+import { connect } from 'react-redux';
+import PureRenderMixin from 'react-addons-pure-render-mixin';
 import StatusListContainer from '../ui/containers/status_list_container';
-import Column              from '../ui/components/column';
+import Column from '../ui/components/column';
 import {
   refreshTimeline,
-  updateTimeline
-}                          from '../../actions/timelines';
+  updateTimeline,
+  deleteFromTimelines
+} from '../../actions/timelines';
 
 const PublicTimeline = React.createClass({
 
@@ -24,7 +25,12 @@ const PublicTimeline = React.createClass({
       this.subscription = App.cable.subscriptions.create('PublicChannel', {
 
         received (data) {
-          dispatch(updateTimeline('public', JSON.parse(data.message)));
+          switch(data.type) {
+            case 'update':
+              return dispatch(updateTimeline('public', JSON.parse(data.message)));
+            case 'delete':
+              return dispatch(deleteFromTimelines(data.id));
+          }
         }
 
       });
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb
index 4f8777a50..43e36c138 100644
--- a/app/services/fan_out_on_write_service.rb
+++ b/app/services/fan_out_on_write_service.rb
@@ -42,12 +42,12 @@ class FanOutOnWriteService < BaseService
     Rails.logger.debug "Delivering status #{status.id} to hashtags"
 
     status.tags.find_each do |tag|
-      FeedManager.instance.broadcast("hashtag:#{tag.name}", id: status.id)
+      FeedManager.instance.broadcast("hashtag:#{tag.name}", type: 'update', id: status.id)
     end
   end
 
   def deliver_to_public(status)
     Rails.logger.debug "Delivering status #{status.id} to public timeline"
-    FeedManager.instance.broadcast(:public, id: status.id)
+    FeedManager.instance.broadcast(:public, type: 'update', id: status.id)
   end
 end