kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Merge remote-tracking branch 'origin/main' into bunker
commit
265b4c646a
|
@ -1,5 +1,4 @@
|
|||
import MockAdapter from 'axios-mock-adapter';
|
||||
import { Map as ImmutableMap } from 'immutable';
|
||||
|
||||
import { staticClient } from 'soapbox/api';
|
||||
import { mockStore } from 'soapbox/jest/test-helpers';
|
||||
|
@ -23,7 +22,7 @@ describe('fetchAboutPage()', () => {
|
|||
{ type: FETCH_ABOUT_PAGE_REQUEST, slug: 'index' },
|
||||
{ type: FETCH_ABOUT_PAGE_SUCCESS, slug: 'index', html: '<h1>Hello world</h1>' },
|
||||
];
|
||||
const store = mockStore(ImmutableMap());
|
||||
const store = mockStore({});
|
||||
|
||||
return store.dispatch(fetchAboutPage()).then(() => {
|
||||
expect(store.getActions()).toEqual(expectedActions);
|
||||
|
@ -35,7 +34,7 @@ describe('fetchAboutPage()', () => {
|
|||
{ type: FETCH_ABOUT_PAGE_REQUEST, slug: 'asdf' },
|
||||
{ type: FETCH_ABOUT_PAGE_FAIL, slug: 'asdf', error: new Error('Request failed with status code 404') },
|
||||
];
|
||||
const store = mockStore(ImmutableMap());
|
||||
const store = mockStore({});
|
||||
|
||||
return store.dispatch(fetchAboutPage('asdf')).catch(() => {
|
||||
expect(store.getActions()).toEqual(expectedActions);
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import { Map as ImmutableMap } from 'immutable';
|
||||
|
||||
import { __stub } from 'soapbox/api';
|
||||
import { mockStore } from 'soapbox/jest/test-helpers';
|
||||
|
||||
|
@ -19,7 +17,7 @@ describe('preloadMastodon()', () => {
|
|||
.reply(200, {});
|
||||
});
|
||||
|
||||
const store = mockStore(ImmutableMap());
|
||||
const store = mockStore({});
|
||||
store.dispatch(preloadMastodon(data));
|
||||
const actions = store.getActions();
|
||||
|
||||
|
|
|
@ -3,16 +3,29 @@ import { useEntities } from 'soapbox/entity-store/hooks';
|
|||
import { useApi } from 'soapbox/hooks';
|
||||
import { adminAccountSchema } from 'soapbox/schemas/admin-account';
|
||||
|
||||
type Filter = 'local' | 'remote' | 'active' | 'pending' | 'disabled' | 'silenced' | 'suspended' | 'sensitized';
|
||||
const allFilters = new Set([
|
||||
'local' as const,
|
||||
'remote' as const,
|
||||
'active' as const,
|
||||
'pending' as const,
|
||||
'disabled' as const,
|
||||
'silenced' as const,
|
||||
'suspended' as const,
|
||||
'sensitized' as const,
|
||||
]);
|
||||
|
||||
/** https://docs.joinmastodon.org/methods/admin/accounts/#v1 */
|
||||
export function useAdminAccounts(filters: Filter[] = [], limit?: number) {
|
||||
export function useAdminAccounts(filters: typeof allFilters, limit?: number) {
|
||||
const api = useApi();
|
||||
|
||||
const searchParams = new URLSearchParams();
|
||||
|
||||
for (const filter of filters) {
|
||||
searchParams.append(filter, 'true');
|
||||
for (const filter of allFilters) {
|
||||
if (filters.has(filter)) {
|
||||
searchParams.append(filter, 'true');
|
||||
} else {
|
||||
searchParams.append(filter, 'false');
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof limit === 'number') {
|
||||
|
|
|
@ -15,7 +15,7 @@ export const ScrollContext: React.FC<IScrollContext> = ({ shouldUpdateScroll, ch
|
|||
const prevLocation = usePrevious(location);
|
||||
|
||||
useEffect(() => {
|
||||
if (prevLocation && shouldUpdateScroll(prevLocation, location)) {
|
||||
if (prevLocation && (prevLocation.pathname !== location.pathname) && shouldUpdateScroll(prevLocation, location)) {
|
||||
window.scrollTo(0, 0);
|
||||
}
|
||||
}, [location, shouldUpdateScroll]);
|
||||
|
|
|
@ -18,7 +18,7 @@ const LatestAccountsPanel: React.FC<ILatestAccountsPanel> = ({ limit = 5 }) => {
|
|||
const intl = useIntl();
|
||||
const history = useHistory();
|
||||
|
||||
const { accounts } = useAdminAccounts(['local', 'active'], limit);
|
||||
const { accounts } = useAdminAccounts(new Set(['local', 'active']), limit);
|
||||
|
||||
const handleAction = () => {
|
||||
history.push('/soapbox/admin/users');
|
||||
|
|
|
@ -15,7 +15,7 @@ const messages = defineMessages({
|
|||
const UserIndex: React.FC = () => {
|
||||
const intl = useIntl();
|
||||
|
||||
const { accounts, isLoading, hasNextPage, fetchNextPage } = useAdminAccounts(['local']);
|
||||
const { accounts, isLoading, hasNextPage, fetchNextPage } = useAdminAccounts(new Set(['local']));
|
||||
|
||||
const handleLoadMore = () => {
|
||||
if (!isLoading) {
|
||||
|
|
|
@ -1154,6 +1154,8 @@
|
|||
"new_group_panel.title": "Crear un Grupo",
|
||||
"nostr_extension.found": "<link>Iniciar sesión</link> con la extensión del navegador.",
|
||||
"nostr_extension.not_found": "No se ha encontrado la extensión del navegador.",
|
||||
"nostr_extension.not_supported": "La extensión del navegador no es compatible. Actualice a la última versión.",
|
||||
"nostr_login.siwe.action": "Iniciar sesión con la extensión",
|
||||
"nostr_panel.message": "Conéctese con cualquier cliente de Nostr.",
|
||||
"nostr_panel.title": "Relés de Nostr",
|
||||
"nostr_relays.read_only": "Solo lectura",
|
||||
|
|
Ładowanie…
Reference in New Issue