]> cat aescling's git repositories - mastodon.git/commitdiff
Fix to update suggestion list after dismiss (#16044)
authorTakeshi Umeda <noel.yoshiba@gmail.com>
Fri, 16 Apr 2021 08:06:16 +0000 (17:06 +0900)
committerGitHub <noreply@github.com>
Fri, 16 Apr 2021 08:06:16 +0000 (10:06 +0200)
* Fix to update suggestion list after dismiss

* Change to inline

* Fix style

app/javascript/mastodon/actions/suggestions.js

index 0bf959017cdeea085895ebd998e84262b7c1c062..336c0c8f6548bacf377299bb46d94ce0ceebe5e7 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(() => {});
 };