Fix live status removal from public/hashtag channels
This commit is contained in:
parent
aabf884c5f
commit
bf5f55a6bb
|
@ -4,7 +4,8 @@ import StatusListContainer from '../ui/containers/status_list_container';
|
||||||
import Column from '../ui/components/column';
|
import Column from '../ui/components/column';
|
||||||
import {
|
import {
|
||||||
refreshTimeline,
|
refreshTimeline,
|
||||||
updateTimeline
|
updateTimeline,
|
||||||
|
deleteFromTimelines
|
||||||
} from '../../actions/timelines';
|
} from '../../actions/timelines';
|
||||||
|
|
||||||
const HashtagTimeline = React.createClass({
|
const HashtagTimeline = React.createClass({
|
||||||
|
@ -24,7 +25,12 @@ const HashtagTimeline = React.createClass({
|
||||||
}, {
|
}, {
|
||||||
|
|
||||||
received (data) {
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
||||||
import StatusListContainer from '../ui/containers/status_list_container';
|
import StatusListContainer from '../ui/containers/status_list_container';
|
||||||
import Column from '../ui/components/column';
|
import Column from '../ui/components/column';
|
||||||
import {
|
import {
|
||||||
refreshTimeline,
|
refreshTimeline,
|
||||||
updateTimeline
|
updateTimeline,
|
||||||
} from '../../actions/timelines';
|
deleteFromTimelines
|
||||||
|
} from '../../actions/timelines';
|
||||||
|
|
||||||
const PublicTimeline = React.createClass({
|
const PublicTimeline = React.createClass({
|
||||||
|
|
||||||
|
@ -24,7 +25,12 @@ const PublicTimeline = React.createClass({
|
||||||
this.subscription = App.cable.subscriptions.create('PublicChannel', {
|
this.subscription = App.cable.subscriptions.create('PublicChannel', {
|
||||||
|
|
||||||
received (data) {
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -42,12 +42,12 @@ class FanOutOnWriteService < BaseService
|
||||||
Rails.logger.debug "Delivering status #{status.id} to hashtags"
|
Rails.logger.debug "Delivering status #{status.id} to hashtags"
|
||||||
|
|
||||||
status.tags.find_each do |tag|
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
def deliver_to_public(status)
|
def deliver_to_public(status)
|
||||||
Rails.logger.debug "Delivering status #{status.id} to public timeline"
|
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
|
||||||
end
|
end
|
||||||
|
|
Reference in New Issue