From: Takeshi Umeda Date: Fri, 16 Apr 2021 08:06:16 +0000 (+0900) Subject: Fix to update suggestion list after dismiss (#16044) X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=9bb334184900f1a4bb0a212cf46542faa0c544fd;p=mastodon.git Fix to update suggestion list after dismiss (#16044) * Fix to update suggestion list after dismiss * Change to inline * Fix style --- diff --git a/app/javascript/mastodon/actions/suggestions.js b/app/javascript/mastodon/actions/suggestions.js index 0bf959017..336c0c8f6 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(() => {}); };