Fix #47 by renaming TIMELINE_SET action to TIMELINE_REFRESH_SUCCESS
This commit is contained in:
parent
1d2856c2af
commit
6d89edc4f7
|
@ -1,6 +1,5 @@
|
||||||
import api from '../api'
|
import api from '../api'
|
||||||
|
|
||||||
export const TIMELINE_SET = 'TIMELINE_SET';
|
|
||||||
export const TIMELINE_UPDATE = 'TIMELINE_UPDATE';
|
export const TIMELINE_UPDATE = 'TIMELINE_UPDATE';
|
||||||
export const TIMELINE_DELETE = 'TIMELINE_DELETE';
|
export const TIMELINE_DELETE = 'TIMELINE_DELETE';
|
||||||
|
|
||||||
|
@ -12,9 +11,9 @@ export const TIMELINE_EXPAND_REQUEST = 'TIMELINE_EXPAND_REQUEST';
|
||||||
export const TIMELINE_EXPAND_SUCCESS = 'TIMELINE_EXPAND_SUCCESS';
|
export const TIMELINE_EXPAND_SUCCESS = 'TIMELINE_EXPAND_SUCCESS';
|
||||||
export const TIMELINE_EXPAND_FAIL = 'TIMELINE_EXPAND_FAIL';
|
export const TIMELINE_EXPAND_FAIL = 'TIMELINE_EXPAND_FAIL';
|
||||||
|
|
||||||
export function setTimeline(timeline, statuses) {
|
export function refreshTimelineSuccess(timeline, statuses) {
|
||||||
return {
|
return {
|
||||||
type: TIMELINE_SET,
|
type: TIMELINE_REFRESH_SUCCESS,
|
||||||
timeline: timeline,
|
timeline: timeline,
|
||||||
statuses: statuses
|
statuses: statuses
|
||||||
};
|
};
|
||||||
|
@ -54,12 +53,6 @@ export function refreshTimeline(timeline) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function refreshTimelineSuccess(timeline, statuses) {
|
|
||||||
return function (dispatch) {
|
|
||||||
dispatch(setTimeline(timeline, statuses));
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export function refreshTimelineFail(timeline, error) {
|
export function refreshTimelineFail(timeline, error) {
|
||||||
return {
|
return {
|
||||||
type: TIMELINE_REFRESH_FAIL,
|
type: TIMELINE_REFRESH_FAIL,
|
||||||
|
|
|
@ -1,15 +1,20 @@
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
import configureStore from '../store/configureStore';
|
import configureStore from '../store/configureStore';
|
||||||
import { setTimeline, updateTimeline, deleteFromTimelines, refreshTimeline } from '../actions/timelines';
|
import {
|
||||||
import { setAccessToken } from '../actions/meta';
|
refreshTimelineSuccess,
|
||||||
import { setAccountSelf } from '../actions/accounts';
|
updateTimeline,
|
||||||
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
deleteFromTimelines,
|
||||||
import { Router, Route, hashHistory } from 'react-router';
|
refreshTimeline
|
||||||
import Account from '../features/account';
|
} from '../actions/timelines';
|
||||||
import Settings from '../features/settings';
|
import { setAccessToken } from '../actions/meta';
|
||||||
import Status from '../features/status';
|
import { setAccountSelf } from '../actions/accounts';
|
||||||
import Subscriptions from '../features/subscriptions';
|
import PureRenderMixin from 'react-addons-pure-render-mixin';
|
||||||
import UI from '../features/ui';
|
import { Router, Route, hashHistory } from 'react-router';
|
||||||
|
import Account from '../features/account';
|
||||||
|
import Settings from '../features/settings';
|
||||||
|
import Status from '../features/status';
|
||||||
|
import Subscriptions from '../features/subscriptions';
|
||||||
|
import UI from '../features/ui';
|
||||||
|
|
||||||
const store = configureStore();
|
const store = configureStore();
|
||||||
|
|
||||||
|
@ -29,7 +34,7 @@ const Mastodon = React.createClass({
|
||||||
|
|
||||||
for (var timelineType in this.props.timelines) {
|
for (var timelineType in this.props.timelines) {
|
||||||
if (this.props.timelines.hasOwnProperty(timelineType)) {
|
if (this.props.timelines.hasOwnProperty(timelineType)) {
|
||||||
store.dispatch(setTimeline(timelineType, JSON.parse(this.props.timelines[timelineType])));
|
store.dispatch(refreshTimelineSuccess(timelineType, JSON.parse(this.props.timelines[timelineType])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {
|
import {
|
||||||
TIMELINE_SET,
|
TIMELINE_REFRESH_SUCCESS,
|
||||||
TIMELINE_UPDATE,
|
TIMELINE_UPDATE,
|
||||||
TIMELINE_DELETE
|
TIMELINE_DELETE
|
||||||
} from '../actions/timelines';
|
} from '../actions/timelines';
|
||||||
|
@ -139,7 +139,7 @@ function normalizeContext(state, status, ancestors, descendants) {
|
||||||
|
|
||||||
export default function timelines(state = initialState, action) {
|
export default function timelines(state = initialState, action) {
|
||||||
switch(action.type) {
|
switch(action.type) {
|
||||||
case TIMELINE_SET:
|
case TIMELINE_REFRESH_SUCCESS:
|
||||||
return normalizeTimeline(state, action.timeline, Immutable.fromJS(action.statuses));
|
return normalizeTimeline(state, action.timeline, Immutable.fromJS(action.statuses));
|
||||||
case TIMELINE_UPDATE:
|
case TIMELINE_UPDATE:
|
||||||
return updateTimeline(state, action.timeline, Immutable.fromJS(action.status));
|
return updateTimeline(state, action.timeline, Immutable.fromJS(action.status));
|
||||||
|
|
Loading…
Reference in a new issue