From 84c7b272e1b74290bf85e26d7cf3c620bf3eddf8 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 14 Mar 2024 10:34:36 +0100 Subject: [PATCH] [Glitch] Fix accounts not getting imported into redux store for some filtered notification types Port 95a5713ff73787bdea8a2d5cb848386bf8c4fe80 to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/actions/notifications.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/javascript/flavours/glitch/actions/notifications.js b/app/javascript/flavours/glitch/actions/notifications.js index d5f7477f68..5b274ff94c 100644 --- a/app/javascript/flavours/glitch/actions/notifications.js +++ b/app/javascript/flavours/glitch/actions/notifications.js @@ -640,7 +640,10 @@ export const fetchNotificationsForRequest = accountId => (dispatch, getState) => api(getState).get('/api/v1/notifications', { params }).then(response => { 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(importFetchedAccounts(response.data.filter(item => item.report).map(item => item.report.target_account))); + dispatch(fetchNotificationsForRequestSuccess(response.data, next?.uri)); }).catch(err => { dispatch(fetchNotificationsForRequestFail(err)); @@ -673,7 +676,10 @@ export const expandNotificationsForRequest = () => (dispatch, getState) => { api(getState).get(url).then(response => { 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(importFetchedAccounts(response.data.filter(item => item.report).map(item => item.report.target_account))); + dispatch(expandNotificationsForRequestSuccess(response.data, next?.uri)); }).catch(err => { dispatch(expandNotificationsForRequestFail(err));