File tree Expand file tree Collapse file tree 3 files changed +22
-10
lines changed
assets/javascripts/components/features Expand file tree Collapse file tree 3 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ import StatusListContainer from '../ui/containers/status_list_container';
44import Column from '../ui/components/column' ;
55import {
66 refreshTimeline ,
7- updateTimeline
7+ updateTimeline ,
8+ deleteFromTimelines
89} from '../../actions/timelines' ;
910
1011const HashtagTimeline = React . createClass ( {
@@ -24,7 +25,12 @@ const HashtagTimeline = React.createClass({
2425 } , {
2526
2627 received ( data ) {
27- dispatch ( updateTimeline ( 'tag' , JSON . parse ( data . message ) ) ) ;
28+ switch ( data . type ) {
29+ case 'update' :
30+ return dispatch ( updateTimeline ( 'tag' , JSON . parse ( data . message ) ) ) ;
31+ case 'delete' :
32+ return dispatch ( deleteFromTimelines ( data . id ) ) ;
33+ }
2834 }
2935
3036 } ) ;
Original file line number Diff line number Diff line change 1- import { connect } from 'react-redux' ;
2- import PureRenderMixin from 'react-addons-pure-render-mixin' ;
1+ import { connect } from 'react-redux' ;
2+ import PureRenderMixin from 'react-addons-pure-render-mixin' ;
33import StatusListContainer from '../ui/containers/status_list_container' ;
4- import Column from '../ui/components/column' ;
4+ import Column from '../ui/components/column' ;
55import {
66 refreshTimeline ,
7- updateTimeline
8- } from '../../actions/timelines' ;
7+ updateTimeline ,
8+ deleteFromTimelines
9+ } from '../../actions/timelines' ;
910
1011const PublicTimeline = React . createClass ( {
1112
@@ -24,7 +25,12 @@ const PublicTimeline = React.createClass({
2425 this . subscription = App . cable . subscriptions . create ( 'PublicChannel' , {
2526
2627 received ( data ) {
27- dispatch ( updateTimeline ( 'public' , JSON . parse ( data . message ) ) ) ;
28+ switch ( data . type ) {
29+ case 'update' :
30+ return dispatch ( updateTimeline ( 'public' , JSON . parse ( data . message ) ) ) ;
31+ case 'delete' :
32+ return dispatch ( deleteFromTimelines ( data . id ) ) ;
33+ }
2834 }
2935
3036 } ) ;
Original file line number Diff line number Diff line change @@ -42,12 +42,12 @@ def deliver_to_hashtags(status)
4242 Rails . logger . debug "Delivering status #{ status . id } to hashtags"
4343
4444 status . tags . find_each do |tag |
45- FeedManager . instance . broadcast ( "hashtag:#{ tag . name } " , id : status . id )
45+ FeedManager . instance . broadcast ( "hashtag:#{ tag . name } " , type : 'update' , id : status . id )
4646 end
4747 end
4848
4949 def deliver_to_public ( status )
5050 Rails . logger . debug "Delivering status #{ status . id } to public timeline"
51- FeedManager . instance . broadcast ( :public , id : status . id )
51+ FeedManager . instance . broadcast ( :public , type : 'update' , id : status . id )
5252 end
5353end
You can’t perform that action at this time.
0 commit comments