From ecdbee271b497268ab6681f69316c63b6d752103 Mon Sep 17 00:00:00 2001 From: oakes Date: Tue, 27 Jun 2023 13:41:05 -0400 Subject: [PATCH 1/3] Fix how familiar followers dialog is rendered --- .../features/ui/components/modals/familiar-followers-modal.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/soapbox/features/ui/components/modals/familiar-followers-modal.tsx b/app/soapbox/features/ui/components/modals/familiar-followers-modal.tsx index 8bbd7adff..67e2d1dce 100644 --- a/app/soapbox/features/ui/components/modals/familiar-followers-modal.tsx +++ b/app/soapbox/features/ui/components/modals/familiar-followers-modal.tsx @@ -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 => , From 985022f857ec5976b09e3dc6b8b9768b321ea506 Mon Sep 17 00:00:00 2001 From: oakes Date: Tue, 27 Jun 2023 13:42:33 -0400 Subject: [PATCH 2/3] Fetch relationships after getting familiar followers --- app/soapbox/actions/familiar-followers.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/soapbox/actions/familiar-followers.ts b/app/soapbox/actions/familiar-followers.ts index 2c82126c6..ee38084ba 100644 --- a/app/soapbox/actions/familiar-followers.ts +++ b/app/soapbox/actions/familiar-followers.ts @@ -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, From 881e8662afbec1b2ec0fb9ddbd5f5ce5a9eee405 Mon Sep 17 00:00:00 2001 From: oakes Date: Tue, 27 Jun 2023 13:43:57 -0400 Subject: [PATCH 3/3] Make fetchRelationships import the data into Entities.RELATIONSHIPS --- app/soapbox/actions/accounts.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/soapbox/actions/accounts.ts b/app/soapbox/actions/accounts.ts index 4b7dcc57e..9c967f98e 100644 --- a/app/soapbox/actions/accounts.ts +++ b/app/soapbox/actions/accounts.ts @@ -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))); };