Merge branch 'ditto-admin' into 'main'
features: enable Mastodon admin on Ditto See merge request soapbox-pub/soapbox!2915
This commit is contained in:
commit
7304f28acc
|
@ -1,4 +1,4 @@
|
||||||
import { OrderedSet as ImmutableOrderedSet, is } from 'immutable';
|
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
|
@ -7,8 +7,6 @@ import { fetchUsers } from 'soapbox/actions/admin';
|
||||||
import { Widget } from 'soapbox/components/ui';
|
import { Widget } from 'soapbox/components/ui';
|
||||||
import AccountContainer from 'soapbox/containers/account-container';
|
import AccountContainer from 'soapbox/containers/account-container';
|
||||||
import { useAppDispatch, useAppSelector } from 'soapbox/hooks';
|
import { useAppDispatch, useAppSelector } from 'soapbox/hooks';
|
||||||
import { selectAccount } from 'soapbox/selectors';
|
|
||||||
import { compareId } from 'soapbox/utils/comparators';
|
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
title: { id: 'admin.latest_accounts_panel.title', defaultMessage: 'Latest Accounts' },
|
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 intl = useIntl();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const accountIds = useAppSelector<ImmutableOrderedSet<string>>((state) => state.admin.get('latestUsers').take(limit));
|
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);
|
const [total, setTotal] = useState(accountIds.size);
|
||||||
|
|
||||||
|
@ -37,13 +33,6 @@ const LatestAccountsPanel: React.FC<ILatestAccountsPanel> = ({ limit = 5 }) => {
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const sortedIds = accountIds.sort(compareId).reverse();
|
|
||||||
const isSorted = hasDates && is(accountIds, sortedIds);
|
|
||||||
|
|
||||||
if (!isSorted || !accountIds || accountIds.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleAction = () => {
|
const handleAction = () => {
|
||||||
history.push('/soapbox/admin/users');
|
history.push('/soapbox/admin/users');
|
||||||
};
|
};
|
||||||
|
|
|
@ -682,6 +682,7 @@ const getInstanceFeatures = (instance: Instance) => {
|
||||||
* @see POST /api/v1/admin/accounts/:account_id/approve
|
* @see POST /api/v1/admin/accounts/:account_id/approve
|
||||||
*/
|
*/
|
||||||
mastodonAdmin: any([
|
mastodonAdmin: any([
|
||||||
|
v.software === DITTO,
|
||||||
v.software === MASTODON && gte(v.compatVersion, '2.9.1'),
|
v.software === MASTODON && gte(v.compatVersion, '2.9.1'),
|
||||||
v.software === PLEROMA && v.build === REBASED && gte(v.version, '2.4.50'),
|
v.software === PLEROMA && v.build === REBASED && gte(v.version, '2.4.50'),
|
||||||
]),
|
]),
|
||||||
|
|
Loading…
Reference in New Issue