File tree 3 files changed +22
-10
lines changed
assets/javascripts/components/features
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';
4
4
import Column from '../ui/components/column' ;
5
5
import {
6
6
refreshTimeline ,
7
- updateTimeline
7
+ updateTimeline ,
8
+ deleteFromTimelines
8
9
} from '../../actions/timelines' ;
9
10
10
11
const HashtagTimeline = React . createClass ( {
@@ -24,7 +25,12 @@ const HashtagTimeline = React.createClass({
24
25
} , {
25
26
26
27
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
+ }
28
34
}
29
35
30
36
} ) ;
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' ;
3
3
import StatusListContainer from '../ui/containers/status_list_container' ;
4
- import Column from '../ui/components/column' ;
4
+ import Column from '../ui/components/column' ;
5
5
import {
6
6
refreshTimeline ,
7
- updateTimeline
8
- } from '../../actions/timelines' ;
7
+ updateTimeline ,
8
+ deleteFromTimelines
9
+ } from '../../actions/timelines' ;
9
10
10
11
const PublicTimeline = React . createClass ( {
11
12
@@ -24,7 +25,12 @@ const PublicTimeline = React.createClass({
24
25
this . subscription = App . cable . subscriptions . create ( 'PublicChannel' , {
25
26
26
27
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
+ }
28
34
}
29
35
30
36
} ) ;
Original file line number Diff line number Diff line change @@ -42,12 +42,12 @@ def deliver_to_hashtags(status)
42
42
Rails . logger . debug "Delivering status #{ status . id } to hashtags"
43
43
44
44
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 )
46
46
end
47
47
end
48
48
49
49
def deliver_to_public ( status )
50
50
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 )
52
52
end
53
53
end
You can’t perform that action at this time.
0 commit comments