]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix to update suggestion list after dismiss
authorTakeshi Umeda <noel.yoshiba@gmail.com>
Fri, 16 Apr 2021 08:06:16 +0000 (17:06 +0900)
committerClaire <claire.github-309c@sitedethib.com>
Wed, 21 Apr 2021 11:50:51 +0000 (13:50 +0200)
Port 9bb334184900f1a4bb0a212cf46542faa0c544fd to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
app/javascript/flavours/glitch/actions/suggestions.js

index 7e8f3713fd5450fc71b39ad5726e285f0ba94036..e867bccf73a68e051ac0c5a265e7aa64778a35b9 100644 (file)
@@ -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(() => {});
 };