Merge branch 'oakes/import-relationships' into 'develop'
Import relationships and fix familiar followers dialog See merge request soapbox-pub/soapbox!2574
This commit is contained in:
commit
9eff8d1e9c
3 changed files with 12 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
|||
import { importEntities } from 'soapbox/entity-store/actions';
|
||||
import { Entities } from 'soapbox/entity-store/entities';
|
||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||
import { getFeatures, parseVersion, PLEROMA } from 'soapbox/utils/features';
|
||||
|
||||
|
@ -607,7 +609,10 @@ const fetchRelationships = (accountIds: string[]) =>
|
|||
|
||||
return api(getState)
|
||||
.get(`/api/v1/accounts/relationships?${newAccountIds.map(id => `id[]=${id}`).join('&')}`)
|
||||
.then(response => dispatch(fetchRelationshipsSuccess(response.data)))
|
||||
.then(response => {
|
||||
dispatch(importEntities(response.data, Entities.RELATIONSHIPS));
|
||||
dispatch(fetchRelationshipsSuccess(response.data));
|
||||
})
|
||||
.catch(error => dispatch(fetchRelationshipsFail(error)));
|
||||
};
|
||||
|
||||
|
|
|
@ -2,8 +2,11 @@ import { AppDispatch, RootState } from 'soapbox/store';
|
|||
|
||||
import api from '../api';
|
||||
|
||||
import { fetchRelationships } from './accounts';
|
||||
import { importFetchedAccounts } from './importer';
|
||||
|
||||
import type { APIEntity } from 'soapbox/types/entities';
|
||||
|
||||
export const FAMILIAR_FOLLOWERS_FETCH_REQUEST = 'FAMILIAR_FOLLOWERS_FETCH_REQUEST';
|
||||
export const FAMILIAR_FOLLOWERS_FETCH_SUCCESS = 'FAMILIAR_FOLLOWERS_FETCH_SUCCESS';
|
||||
export const FAMILIAR_FOLLOWERS_FETCH_FAIL = 'FAMILIAR_FOLLOWERS_FETCH_FAIL';
|
||||
|
@ -19,6 +22,7 @@ export const fetchAccountFamiliarFollowers = (accountId: string) => (dispatch: A
|
|||
const accounts = data.find(({ id }: { id: string }) => id === accountId).accounts;
|
||||
|
||||
dispatch(importFetchedAccounts(accounts));
|
||||
dispatch(fetchRelationships(accounts.map((item: APIEntity) => item.id)));
|
||||
dispatch({
|
||||
type: FAMILIAR_FOLLOWERS_FETCH_SUCCESS,
|
||||
id: accountId,
|
||||
|
|
|
@ -35,6 +35,8 @@ const FamiliarFollowersModal = ({ accountId, onClose }: IFamiliarFollowersModal)
|
|||
scrollKey='familiar_followers'
|
||||
emptyMessage={emptyMessage}
|
||||
itemClassName='pb-3'
|
||||
style={{ height: '80vh' }}
|
||||
useWindowScroll={false}
|
||||
>
|
||||
{familiarFollowerIds.map(id =>
|
||||
<AccountContainer key={id} id={id} />,
|
||||
|
|
Loading…
Reference in a new issue