revert c280c102b
This commit is contained in:
parent
e1e6e07ea8
commit
08365cbead
@ -147,23 +147,17 @@ export function expandNotifications({ maxId } = {}, done = noOp) {
|
|||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
if (!me) return
|
if (!me) return
|
||||||
|
|
||||||
console.log("-1-expandNotifications:", maxId, done)
|
|
||||||
|
|
||||||
const onlyVerified = getState().getIn(['notifications', 'filter', 'onlyVerified'])
|
const onlyVerified = getState().getIn(['notifications', 'filter', 'onlyVerified'])
|
||||||
const onlyFollowing = getState().getIn(['notifications', 'filter', 'onlyFollowing'])
|
const onlyFollowing = getState().getIn(['notifications', 'filter', 'onlyFollowing'])
|
||||||
const activeFilter = getState().getIn(['notifications', 'filter', 'active'])
|
const activeFilter = getState().getIn(['notifications', 'filter', 'active'])
|
||||||
const notifications = getState().get('notifications')
|
const notifications = getState().get('notifications')
|
||||||
const isLoadingMore = !!maxId
|
const isLoadingMore = !!maxId
|
||||||
|
|
||||||
console.log("-2-expandNotifications:", isLoadingMore)
|
|
||||||
|
|
||||||
if (notifications.get('isLoading')) {
|
if (notifications.get('isLoading')) {
|
||||||
done();
|
done();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("-3-expandNotifications")
|
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
max_id: maxId,
|
max_id: maxId,
|
||||||
exclude_types: activeFilter === 'all' ? null : excludeTypesFromFilter(activeFilter),
|
exclude_types: activeFilter === 'all' ? null : excludeTypesFromFilter(activeFilter),
|
||||||
@ -176,32 +170,20 @@ export function expandNotifications({ maxId } = {}, done = noOp) {
|
|||||||
params.since_id = notifications.getIn(['items', 0, 'id']);
|
params.since_id = notifications.getIn(['items', 0, 'id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("-4-expandNotifications:", params)
|
|
||||||
|
|
||||||
dispatch(expandNotificationsRequest(isLoadingMore));
|
dispatch(expandNotificationsRequest(isLoadingMore));
|
||||||
|
|
||||||
api(getState).get('/api/v1/notifications', { params }).then(response => {
|
api(getState).get('/api/v1/notifications', { params }).then(response => {
|
||||||
console.log("-5-(res)-expandNotifications:", response)
|
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
|
|
||||||
console.log("-6-(res)-expandNotifications")
|
|
||||||
|
|
||||||
dispatch(importFetchedAccounts(response.data.map(item => item.account)));
|
dispatch(importFetchedAccounts(response.data.map(item => item.account)));
|
||||||
dispatch(importFetchedStatuses(response.data.map(item => item.status).filter(status => !!status)));
|
dispatch(importFetchedStatuses(response.data.map(item => item.status).filter(status => !!status)));
|
||||||
|
|
||||||
console.log("-7-(res)-expandNotifications")
|
|
||||||
|
|
||||||
dispatch(expandNotificationsSuccess(response.data, next ? next.uri : null, isLoadingMore));
|
dispatch(expandNotificationsSuccess(response.data, next ? next.uri : null, isLoadingMore));
|
||||||
|
|
||||||
console.log("-8-(res)-expandNotifications")
|
|
||||||
|
|
||||||
fetchRelatedRelationships(dispatch, response.data);
|
fetchRelatedRelationships(dispatch, response.data);
|
||||||
|
|
||||||
console.log("-9-(res)-expandNotifications")
|
|
||||||
|
|
||||||
done();
|
done();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log("-10-(error)-expandNotifications:", error, isLoadingMore)
|
|
||||||
dispatch(expandNotificationsFail(error, isLoadingMore));
|
dispatch(expandNotificationsFail(error, isLoadingMore));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
@ -216,7 +198,6 @@ export function expandNotificationsRequest(isLoadingMore) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function expandNotificationsSuccess(notifications, next, isLoadingMore) {
|
export function expandNotificationsSuccess(notifications, next, isLoadingMore) {
|
||||||
console.log("-11-expandNotificationsSuccess:", notifications, next, isLoadingMore)
|
|
||||||
return {
|
return {
|
||||||
type: NOTIFICATIONS_EXPAND_SUCCESS,
|
type: NOTIFICATIONS_EXPAND_SUCCESS,
|
||||||
notifications,
|
notifications,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user