[Glitch] Add cold-start follow recommendations
Port front-end changes from f7117646af
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
remotes/1727458204337373841/tmp_refs/heads/signup-info-prompt
parent
97da7b7307
commit
e6501d5112
|
@ -11,8 +11,8 @@ export function fetchSuggestions() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch(fetchSuggestionsRequest());
|
dispatch(fetchSuggestionsRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/suggestions').then(response => {
|
api(getState).get('/api/v2/suggestions').then(response => {
|
||||||
dispatch(importFetchedAccounts(response.data));
|
dispatch(importFetchedAccounts(response.data.map(x => x.account)));
|
||||||
dispatch(fetchSuggestionsSuccess(response.data));
|
dispatch(fetchSuggestionsSuccess(response.data));
|
||||||
}).catch(error => dispatch(fetchSuggestionsFail(error)));
|
}).catch(error => dispatch(fetchSuggestionsFail(error)));
|
||||||
};
|
};
|
||||||
|
@ -25,10 +25,10 @@ export function fetchSuggestionsRequest() {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function fetchSuggestionsSuccess(accounts) {
|
export function fetchSuggestionsSuccess(suggestions) {
|
||||||
return {
|
return {
|
||||||
type: SUGGESTIONS_FETCH_SUCCESS,
|
type: SUGGESTIONS_FETCH_SUCCESS,
|
||||||
accounts,
|
suggestions,
|
||||||
skipLoading: true,
|
skipLoading: true,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -51,13 +51,13 @@ class SearchResults extends ImmutablePureComponent {
|
||||||
<FormattedMessage id='suggestions.header' defaultMessage='You might be interested in…' />
|
<FormattedMessage id='suggestions.header' defaultMessage='You might be interested in…' />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{suggestions && suggestions.map(accountId => (
|
{suggestions && suggestions.map(suggestion => (
|
||||||
<AccountContainer
|
<AccountContainer
|
||||||
key={accountId}
|
key={suggestion.get('account')}
|
||||||
id={accountId}
|
id={suggestion.get('account')}
|
||||||
actionIcon='times'
|
actionIcon={suggestion.get('source') === 'past_interaction' && 'times'}
|
||||||
actionTitle={intl.formatMessage(messages.dismissSuggestion)}
|
actionTitle={suggestion.get('source') === 'past_interaction' && intl.formatMessage(messages.dismissSuggestion)}
|
||||||
onActionClick={dismissSuggestion}
|
onActionClick={suggestion.get('source') === 'past_interaction' && dismissSuggestion}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,18 +19,18 @@ export default function suggestionsReducer(state = initialState, action) {
|
||||||
return state.set('isLoading', true);
|
return state.set('isLoading', true);
|
||||||
case SUGGESTIONS_FETCH_SUCCESS:
|
case SUGGESTIONS_FETCH_SUCCESS:
|
||||||
return state.withMutations(map => {
|
return state.withMutations(map => {
|
||||||
map.set('items', fromJS(action.accounts.map(x => x.id)));
|
map.set('items', fromJS(action.suggestions.map(x => ({ ...x, account: x.account.id }))));
|
||||||
map.set('isLoading', false);
|
map.set('isLoading', false);
|
||||||
});
|
});
|
||||||
case SUGGESTIONS_FETCH_FAIL:
|
case SUGGESTIONS_FETCH_FAIL:
|
||||||
return state.set('isLoading', false);
|
return state.set('isLoading', false);
|
||||||
case SUGGESTIONS_DISMISS:
|
case SUGGESTIONS_DISMISS:
|
||||||
return state.update('items', list => list.filterNot(id => id === action.id));
|
return state.update('items', list => list.filterNot(x => x.account === action.id));
|
||||||
case ACCOUNT_BLOCK_SUCCESS:
|
case ACCOUNT_BLOCK_SUCCESS:
|
||||||
case ACCOUNT_MUTE_SUCCESS:
|
case ACCOUNT_MUTE_SUCCESS:
|
||||||
return state.update('items', list => list.filterNot(id => id === action.relationship.id));
|
return state.update('items', list => list.filterNot(x => x.account === action.relationship.id));
|
||||||
case DOMAIN_BLOCK_SUCCESS:
|
case DOMAIN_BLOCK_SUCCESS:
|
||||||
return state.update('items', list => list.filterNot(id => action.accounts.includes(id)));
|
return state.update('items', list => list.filterNot(x => action.accounts.includes(x.account)));
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue