[Glitch] Add endorsed accounts to profiles in web UI

Port 79013c730d to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Eugen Rochko
2025-04-29 14:14:22 +02:00
committed by Claire
parent b4e39a60c3
commit 6373a84259
20 changed files with 156 additions and 113 deletions

View File

@@ -5,9 +5,7 @@ import {
fetchDirectory
} from 'flavours/glitch/actions/directory';
import {
FEATURED_TAGS_FETCH_REQUEST,
FEATURED_TAGS_FETCH_SUCCESS,
FEATURED_TAGS_FETCH_FAIL,
fetchFeaturedTags
} from 'flavours/glitch/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