diff --git a/src/actions/about.test.ts b/src/actions/about.test.ts index 282e80c37..e05a7f643 100644 --- a/src/actions/about.test.ts +++ b/src/actions/about.test.ts @@ -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: '

Hello world

' }, ]; - 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); diff --git a/src/actions/preload.test.ts b/src/actions/preload.test.ts index 8e4b30f5c..24a5f86b3 100644 --- a/src/actions/preload.test.ts +++ b/src/actions/preload.test.ts @@ -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(); diff --git a/src/api/hooks/admin/useAdminAccounts.ts b/src/api/hooks/admin/useAdminAccounts.ts index cb329ced6..ebd1a7004 100644 --- a/src/api/hooks/admin/useAdminAccounts.ts +++ b/src/api/hooks/admin/useAdminAccounts.ts @@ -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') { diff --git a/src/components/scroll-context.tsx b/src/components/scroll-context.tsx index ad427659f..1f74f244f 100644 --- a/src/components/scroll-context.tsx +++ b/src/components/scroll-context.tsx @@ -15,7 +15,7 @@ export const ScrollContext: React.FC = ({ 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]); diff --git a/src/features/admin/components/latest-accounts-panel.tsx b/src/features/admin/components/latest-accounts-panel.tsx index c179afaf3..1d9004407 100644 --- a/src/features/admin/components/latest-accounts-panel.tsx +++ b/src/features/admin/components/latest-accounts-panel.tsx @@ -18,7 +18,7 @@ const LatestAccountsPanel: React.FC = ({ 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'); diff --git a/src/features/admin/user-index.tsx b/src/features/admin/user-index.tsx index 93d418d96..bb12d1b49 100644 --- a/src/features/admin/user-index.tsx +++ b/src/features/admin/user-index.tsx @@ -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) { diff --git a/src/locales/es.json b/src/locales/es.json index d6cdf475e..33b1c451e 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -1154,6 +1154,8 @@ "new_group_panel.title": "Crear un Grupo", "nostr_extension.found": "Iniciar sesión 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",