commit: 8d0284f8d9bc22a6dd3bad1054fd8d78cbf32060
parent: 98560b232acc9d16d3515133721266f170e31ae6
Author: Eugen Rochko <eugen@zeonfederated.com>
Date: Thu, 19 Jan 2017 11:23:24 +0100
Hide more non-essential loading bars
Diffstat:
2 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/app/assets/javascripts/components/actions/accounts.jsx b/app/assets/javascripts/components/actions/accounts.jsx
@@ -508,21 +508,24 @@ export function fetchRelationships(account_ids) {
export function fetchRelationshipsRequest(ids) {
return {
type: RELATIONSHIPS_FETCH_REQUEST,
- ids
+ ids,
+ skipLoading: true
};
};
export function fetchRelationshipsSuccess(relationships) {
return {
type: RELATIONSHIPS_FETCH_SUCCESS,
- relationships
+ relationships,
+ skipLoading: true
};
};
export function fetchRelationshipsFail(error) {
return {
type: RELATIONSHIPS_FETCH_FAIL,
- error
+ error,
+ skipLoading: true
};
};
diff --git a/app/assets/javascripts/components/actions/timelines.jsx b/app/assets/javascripts/components/actions/timelines.jsx
@@ -14,11 +14,12 @@ export const TIMELINE_EXPAND_FAIL = 'TIMELINE_EXPAND_FAIL';
export const TIMELINE_SCROLL_TOP = 'TIMELINE_SCROLL_TOP';
-export function refreshTimelineSuccess(timeline, statuses) {
+export function refreshTimelineSuccess(timeline, statuses, skipLoading) {
return {
type: TIMELINE_REFRESH_SUCCESS,
- timeline: timeline,
- statuses: statuses
+ timeline,
+ statuses,
+ skipLoading
};
};
@@ -51,45 +52,49 @@ export function deleteFromTimelines(id) {
};
};
-export function refreshTimelineRequest(timeline, id) {
+export function refreshTimelineRequest(timeline, id, skipLoading) {
return {
type: TIMELINE_REFRESH_REQUEST,
timeline,
- id
+ id,
+ skipLoading
};
};
export function refreshTimeline(timeline, id = null) {
return function (dispatch, getState) {
- dispatch(refreshTimelineRequest(timeline, id));
-
const ids = getState().getIn(['timelines', timeline, 'items'], Immutable.List());
const newestId = ids.size > 0 ? ids.first() : null;
- let params = '';
- let path = timeline;
+ let params = '';
+ let path = timeline;
+ let skipLoading = false;
if (newestId !== null && getState().getIn(['timelines', timeline, 'loaded'])) {
- params = `?since_id=${newestId}`;
+ params = `?since_id=${newestId}`;
+ skipLoading = true;
}
if (id) {
path = `${path}/${id}`
}
+ dispatch(refreshTimelineRequest(timeline, id, skipLoading));
+
api(getState).get(`/api/v1/timelines/${path}${params}`).then(function (response) {
- dispatch(refreshTimelineSuccess(timeline, response.data));
+ dispatch(refreshTimelineSuccess(timeline, response.data, skipLoading));
}).catch(function (error) {
- dispatch(refreshTimelineFail(timeline, error));
+ dispatch(refreshTimelineFail(timeline, error, skipLoading));
});
};
};
-export function refreshTimelineFail(timeline, error) {
+export function refreshTimelineFail(timeline, error, skipLoading) {
return {
type: TIMELINE_REFRESH_FAIL,
timeline,
- error
+ error,
+ skipLoading
};
};