Merge branch 'ditto-admin' into 'main'

features: enable Mastodon admin on Ditto

See merge request soapbox-pub/soapbox!2915
This commit is contained in:
Alex Gleason 2024-01-05 21:43:32 +00:00
commit 7304f28acc
2 changed files with 2 additions and 12 deletions

View file

@ -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');
};

View file

@ -682,6 +682,7 @@ const getInstanceFeatures = (instance: Instance) => {
* @see POST /api/v1/admin/accounts/:account_id/approve
*/
mastodonAdmin: any([
v.software === DITTO,
v.software === MASTODON && gte(v.compatVersion, '2.9.1'),
v.software === PLEROMA && v.build === REBASED && gte(v.version, '2.4.50'),
]),