Updated fetchRelationships for accounts and importing

• Updated:
- fetchRelationships for accounts and importing relationships on timeline fetches
This commit is contained in:
mgabdev
2020-06-12 19:38:05 -04:00
parent 4ca59477d5
commit 6f12f94c8c
2 changed files with 17 additions and 2 deletions

View File

@@ -577,7 +577,10 @@ export function fetchRelationships(accountIds) {
if (!me) return;
const loadedRelationships = getState().get('relationships');
const newAccountIds = accountIds.filter(id => loadedRelationships.get(id, null) === null);
let newAccountIds = accountIds.filter((id) => {
if (id === me) return false
return loadedRelationships.get(id, null) === null
})
if (newAccountIds.length === 0) {
return;
@@ -586,6 +589,9 @@ export function fetchRelationships(accountIds) {
if (me === firstId) return;
}
// Unique
newAccountIds = Array.from(new Set(newAccountIds))
dispatch(fetchRelationshipsRequest(newAccountIds));
api(getState).get(`/api/v1/accounts/relationships?${newAccountIds.map(id => `id[]=${id}`).join('&')}`).then(response => {