diff options
author | Kai Schaper <303@posteo.de> | 2016-10-20 17:35:05 +0200 |
---|---|---|
committer | Kai Schaper <303@posteo.de> | 2016-10-20 17:35:05 +0200 |
commit | 4b0e3eb1fbc462ee873ad5a996cca25e361ec9fa (patch) | |
tree | 557bea513320b8d6970604c75aab4cac58c7ea85 /app/assets/javascripts/components/actions | |
parent | 19cfe64455d805e7c21a4176256cc3e72d062d0b (diff) | |
parent | 04bbc576906ff70feed7d42fef0e6db17fdd9ed3 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'app/assets/javascripts/components/actions')
-rw-r--r-- | app/assets/javascripts/components/actions/accounts.jsx | 11 | ||||
-rw-r--r-- | app/assets/javascripts/components/actions/timelines.jsx | 11 |
2 files changed, 12 insertions, 10 deletions
diff --git a/app/assets/javascripts/components/actions/accounts.jsx b/app/assets/javascripts/components/actions/accounts.jsx index c1c99d6bd..eacbeef06 100644 --- a/app/assets/javascripts/components/actions/accounts.jsx +++ b/app/assets/javascripts/components/actions/accounts.jsx @@ -53,7 +53,7 @@ export function fetchAccount(id) { }; }; -export function fetchAccountTimeline(id) { +export function fetchAccountTimeline(id, replace = false) { return (dispatch, getState) => { dispatch(fetchAccountTimelineRequest(id)); @@ -62,12 +62,12 @@ export function fetchAccountTimeline(id) { let params = ''; - if (newestId !== null) { + if (newestId !== null && !replace) { params = `?since_id=${newestId}`; } api(getState).get(`/api/v1/accounts/${id}/statuses${params}`).then(response => { - dispatch(fetchAccountTimelineSuccess(id, response.data)); + dispatch(fetchAccountTimelineSuccess(id, response.data, replace)); }).catch(error => { dispatch(fetchAccountTimelineFail(id, error)); }); @@ -184,11 +184,12 @@ export function fetchAccountTimelineRequest(id) { }; }; -export function fetchAccountTimelineSuccess(id, statuses) { +export function fetchAccountTimelineSuccess(id, statuses, replace) { return { type: ACCOUNT_TIMELINE_FETCH_SUCCESS, id: id, - statuses: statuses + statuses: statuses, + replace: replace }; }; diff --git a/app/assets/javascripts/components/actions/timelines.jsx b/app/assets/javascripts/components/actions/timelines.jsx index 5258d7103..831065feb 100644 --- a/app/assets/javascripts/components/actions/timelines.jsx +++ b/app/assets/javascripts/components/actions/timelines.jsx @@ -11,11 +11,12 @@ export const TIMELINE_EXPAND_REQUEST = 'TIMELINE_EXPAND_REQUEST'; export const TIMELINE_EXPAND_SUCCESS = 'TIMELINE_EXPAND_SUCCESS'; export const TIMELINE_EXPAND_FAIL = 'TIMELINE_EXPAND_FAIL'; -export function refreshTimelineSuccess(timeline, statuses) { +export function refreshTimelineSuccess(timeline, statuses, replace) { return { type: TIMELINE_REFRESH_SUCCESS, timeline: timeline, - statuses: statuses + statuses: statuses, + replace: replace }; }; @@ -41,7 +42,7 @@ export function refreshTimelineRequest(timeline) { }; }; -export function refreshTimeline(timeline) { +export function refreshTimeline(timeline, replace = false) { return function (dispatch, getState) { dispatch(refreshTimelineRequest(timeline)); @@ -50,12 +51,12 @@ export function refreshTimeline(timeline) { let params = ''; - if (newestId !== null) { + if (newestId !== null && !replace) { params = `?since_id=${newestId}`; } api(getState).get(`/api/v1/statuses/${timeline}${params}`).then(function (response) { - dispatch(refreshTimelineSuccess(timeline, response.data)); + dispatch(refreshTimelineSuccess(timeline, response.data, replace)); }).catch(function (error) { dispatch(refreshTimelineFail(timeline, error)); }); |