LatestAccountsPanel: don't hide unsorted admin accounts, removes legacy Pleroma hack

environments/review-ditto-admi-xwpr39/deployments/4349
Alex Gleason 9 months ago
parent 2a0d701fea
commit 8009299df6
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

@ -1,4 +1,4 @@
import { OrderedSet as ImmutableOrderedSet, is } from 'immutable';
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
import React, { useEffect, useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { useHistory } from 'react-router-dom';
@ -7,8 +7,6 @@ import { fetchUsers } from 'soapbox/actions/admin';
import { Widget } from 'soapbox/components/ui';
import AccountContainer from 'soapbox/containers/account-container';
import { useAppDispatch, useAppSelector } from 'soapbox/hooks';
import { selectAccount } from 'soapbox/selectors';
import { compareId } from 'soapbox/utils/comparators';
const messages = defineMessages({
title: { id: 'admin.latest_accounts_panel.title', defaultMessage: 'Latest Accounts' },
@ -23,9 +21,7 @@ const LatestAccountsPanel: React.FC<ILatestAccountsPanel> = ({ limit = 5 }) => {
const intl = useIntl();
const history = useHistory();
const dispatch = useAppDispatch();
const accountIds = useAppSelector<ImmutableOrderedSet<string>>((state) => state.admin.get('latestUsers').take(limit));
const hasDates = useAppSelector((state) => accountIds.every(id => !!selectAccount(state, id)?.created_at));
const [total, setTotal] = useState(accountIds.size);
@ -37,13 +33,6 @@ const LatestAccountsPanel: React.FC<ILatestAccountsPanel> = ({ limit = 5 }) => {
.catch(() => {});
}, []);
const sortedIds = accountIds.sort(compareId).reverse();
const isSorted = hasDates && is(accountIds, sortedIds);
if (!isSorted || !accountIds || accountIds.isEmpty()) {
return null;
}
const handleAction = () => {
history.push('/soapbox/admin/users');
};

Loading…
Cancel
Save