From 9bb334184900f1a4bb0a212cf46542faa0c544fd Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Fri, 16 Apr 2021 17:06:16 +0900 Subject: [PATCH] Fix to update suggestion list after dismiss (#16044) * Fix to update suggestion list after dismiss * Change to inline * Fix style --- app/javascript/mastodon/actions/suggestions.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/actions/suggestions.js b/app/javascript/mastodon/actions/suggestions.js index 0bf959017c..336c0c8f65 100644 --- a/app/javascript/mastodon/actions/suggestions.js +++ b/app/javascript/mastodon/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(() => {}); };