Merge remote-tracking branch 'origin/main' into bunker

environments/review-update-vid-g70vyz/deployments/5013
Alex Gleason 2024-10-29 18:41:50 -05:00
commit 265b4c646a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
7 zmienionych plików z 25 dodań i 13 usunięć

Wyświetl plik

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

Wyświetl plik

@ -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();

Wyświetl plik

@ -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') {

Wyświetl plik

@ -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]);

Wyświetl plik

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

Wyświetl plik

@ -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) {

Wyświetl plik

@ -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",