Add endorsed accounts to profiles in web UI (#34568)

This commit is contained in:
Eugen Rochko 2025-04-29 14:14:22 +02:00 committed by GitHub
commit 79013c730d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 157 additions and 113 deletions

View file

@ -5,9 +5,7 @@ import {
fetchDirectory
} from 'mastodon/actions/directory';
import {
FEATURED_TAGS_FETCH_REQUEST,
FEATURED_TAGS_FETCH_SUCCESS,
FEATURED_TAGS_FETCH_FAIL,
fetchFeaturedTags
} from 'mastodon/actions/featured_tags';
import {
@ -31,6 +29,7 @@ import {
FOLLOW_REQUESTS_EXPAND_FAIL,
authorizeFollowRequestSuccess,
rejectFollowRequestSuccess,
fetchEndorsedAccounts,
} from '../actions/accounts';
import {
BLOCKS_FETCH_REQUEST,
@ -191,21 +190,27 @@ export default function userLists(state = initialState, action) {
case MUTES_FETCH_FAIL:
case MUTES_EXPAND_FAIL:
return state.setIn(['mutes', 'isLoading'], false);
case FEATURED_TAGS_FETCH_SUCCESS:
return normalizeFeaturedTags(state, ['featured_tags', action.id], action.tags, action.id);
case FEATURED_TAGS_FETCH_REQUEST:
return state.setIn(['featured_tags', action.id, 'isLoading'], true);
case FEATURED_TAGS_FETCH_FAIL:
return state.setIn(['featured_tags', action.id, 'isLoading'], false);
default:
if(fetchDirectory.fulfilled.match(action))
if (fetchEndorsedAccounts.fulfilled.match(action))
return normalizeList(state, ['featured_accounts', action.meta.arg.accountId], action.payload, undefined);
else if (fetchEndorsedAccounts.pending.match(action))
return state.setIn(['featured_accounts', action.meta.arg.accountId, 'isLoading'], true);
else if (fetchEndorsedAccounts.rejected.match(action))
return state.setIn(['featured_accounts', action.meta.arg.accountId, 'isLoading'], false);
else if (fetchFeaturedTags.fulfilled.match(action))
return normalizeFeaturedTags(state, ['featured_tags', action.meta.arg.accountId], action.payload, action.meta.arg.accountId);
else if (fetchFeaturedTags.pending.match(action))
return state.setIn(['featured_tags', action.meta.arg.accountId, 'isLoading'], true);
else if (fetchFeaturedTags.rejected.match(action))
return state.setIn(['featured_tags', action.meta.arg.accountId, 'isLoading'], false);
else if (fetchDirectory.fulfilled.match(action))
return normalizeList(state, ['directory'], action.payload.accounts, undefined);
else if( expandDirectory.fulfilled.match(action))
else if (expandDirectory.fulfilled.match(action))
return appendToList(state, ['directory'], action.payload.accounts, undefined);
else if(fetchDirectory.pending.match(action) ||
else if (fetchDirectory.pending.match(action) ||
expandDirectory.pending.match(action))
return state.setIn(['directory', 'isLoading'], true);
else if(fetchDirectory.rejected.match(action) ||
else if (fetchDirectory.rejected.match(action) ||
expandDirectory.rejected.match(action))
return state.setIn(['directory', 'isLoading'], false);
else