[Glitch] Fix accounts not getting imported into redux store for some filtered notification types
Port 95a5713ff7
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
4b2a935c4a
commit
84c7b272e1
1 changed files with 6 additions and 0 deletions
|
@ -640,7 +640,10 @@ export const fetchNotificationsForRequest = accountId => (dispatch, getState) =>
|
||||||
|
|
||||||
api(getState).get('/api/v1/notifications', { params }).then(response => {
|
api(getState).get('/api/v1/notifications', { params }).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
|
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)));
|
||||||
|
dispatch(importFetchedAccounts(response.data.filter(item => item.report).map(item => item.report.target_account)));
|
||||||
|
|
||||||
dispatch(fetchNotificationsForRequestSuccess(response.data, next?.uri));
|
dispatch(fetchNotificationsForRequestSuccess(response.data, next?.uri));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
dispatch(fetchNotificationsForRequestFail(err));
|
dispatch(fetchNotificationsForRequestFail(err));
|
||||||
|
@ -673,7 +676,10 @@ export const expandNotificationsForRequest = () => (dispatch, getState) => {
|
||||||
|
|
||||||
api(getState).get(url).then(response => {
|
api(getState).get(url).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
|
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)));
|
||||||
|
dispatch(importFetchedAccounts(response.data.filter(item => item.report).map(item => item.report.target_account)));
|
||||||
|
|
||||||
dispatch(expandNotificationsForRequestSuccess(response.data, next?.uri));
|
dispatch(expandNotificationsForRequestSuccess(response.data, next?.uri));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
dispatch(expandNotificationsForRequestFail(err));
|
dispatch(expandNotificationsForRequestFail(err));
|
||||||
|
|
Loading…
Reference in a new issue