about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/actions
diff options
context:
space:
mode:
authorTakeshi Umeda <noel.yoshiba@gmail.com>2021-04-16 17:06:16 +0900
committerClaire <claire.github-309c@sitedethib.com>2021-04-21 13:50:51 +0200
commit72eac238ba1160f3110fa337db51d85840c781e0 (patch)
treebd689c89e5689c026581b1902908dee31490494c /app/javascript/flavours/glitch/actions
parent8fc0b592cbae280373d05abb6c823e157640a0a9 (diff)
[Glitch] Fix to update suggestion list after dismiss
Port 9bb334184900f1a4bb0a212cf46542faa0c544fd to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/actions')
-rw-r--r--app/javascript/flavours/glitch/actions/suggestions.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/actions/suggestions.js b/app/javascript/flavours/glitch/actions/suggestions.js
index 7e8f3713f..e867bccf7 100644
--- a/app/javascript/flavours/glitch/actions/suggestions.js
+++ b/app/javascript/flavours/glitch/actions/suggestions.js
@@ -48,5 +48,12 @@ export const dismissSuggestion = accountId => (dispatch, getState) => {
     id: accountId,
   });
 
-  api(getState).delete(`/api/v1/suggestions/${accountId}`);
+  api(getState).delete(`/api/v1/suggestions/${accountId}`).then(() => {
+    dispatch(fetchSuggestionsRequest());
+
+    api(getState).get('/api/v2/suggestions').then(response => {
+      dispatch(importFetchedAccounts(response.data.map(x => x.account)));
+      dispatch(fetchSuggestionsSuccess(response.data));
+    }).catch(error => dispatch(fetchSuggestionsFail(error)));
+  }).catch(() => {});
 };