Merge branch 'main' into small-details-zap-split-polish

Conflicts:
	src/actions/admin.ts
	src/features/ui/index.tsx
	src/features/ui/util/async-components.ts
	src/schemas/instance.ts
This commit is contained in:
P. Reis 2024-11-16 19:03:08 -03:00
commit 5102494e5b
1162 changed files with 9410 additions and 9485 deletions

View File

@ -37,14 +37,6 @@
"react": { "react": {
"version": "detect" "version": "detect"
}, },
"import/extensions": [
".js",
".jsx",
".cjs",
".mjs",
".ts",
".tsx"
],
"import/ignore": [ "import/ignore": [
"node_modules", "node_modules",
"\\.(css|scss|json)$" "\\.(css|scss|json)$"
@ -268,17 +260,7 @@
"jsx-a11y/role-supports-aria-props": "off", "jsx-a11y/role-supports-aria-props": "off",
"jsx-a11y/scope": "warn", "jsx-a11y/scope": "warn",
"jsx-a11y/tabindex-no-positive": "warn", "jsx-a11y/tabindex-no-positive": "warn",
"import/extensions": [ "import/extensions": ["error", "ignorePackages"],
"error",
"always",
{
"js": "never",
"mjs": "ignorePackages",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
],
"import/newline-after-import": "error", "import/newline-after-import": "error",
"import/no-extraneous-dependencies": "error", "import/no-extraneous-dependencies": "error",
"import/no-unresolved": "error", "import/no-unresolved": "error",

View File

@ -18,5 +18,10 @@
} }
], ],
"scss.validate": false, "scss.validate": false,
"typescript.tsdk": "node_modules/typescript/lib" "typescript.tsdk": "node_modules/typescript/lib",
"path-intellisense.extensionOnImport": true,
"javascript.preferences.importModuleSpecifierEnding": "js",
"javascript.preferences.importModuleSpecifier": "non-relative",
"typescript.preferences.importModuleSpecifierEnding": "js",
"typescript.preferences.importModuleSpecifier": "non-relative"
} }

View File

@ -21,6 +21,6 @@
</div> </div>
</div> </div>
</div> </div>
<noscript>To use this website, please enable JavaScript.</noscript> <noscript class="text-center">To use this website, please enable JavaScript.</noscript>
</body> </body>
</html> </html>

View File

@ -21,16 +21,15 @@
"url": "lightning:alex@alexgleason.me" "url": "lightning:alex@alexgleason.me"
}, },
"scripts": { "scripts": {
"start": "npx vite serve", "start": "vite serve",
"dev": "npx vite serve", "dev": "vite serve",
"build": "npx vite build --emptyOutDir", "build": "vite build --emptyOutDir",
"preview": "npx vite preview", "preview": "vite preview",
"audit:fix": "npx yarn-audit-fix", "i18n": "formatjs extract 'src/**/*.{ts,tsx}' --ignore '**/*.d.ts' --out-file build/messages.json && formatjs compile build/messages.json --out-file src/locales/en.json",
"i18n": "npx formatjs extract 'src/**/*.{ts,tsx}' --ignore '**/*.d.ts' --out-file build/messages.json && npx formatjs compile build/messages.json --out-file src/locales/en.json", "test": "vitest",
"test": "npx vitest",
"lint": "npm run lint:js && npm run lint:sass", "lint": "npm run lint:js && npm run lint:sass",
"lint:js": "npx eslint --ext .js,.jsx,.cjs,.mjs,.ts,.tsx . --cache", "lint:js": "eslint --ext .js,.jsx,.cjs,.mjs,.ts,.tsx . --cache",
"lint:sass": "npx stylelint src/styles/**/*.scss", "lint:sass": "stylelint src/styles/**/*.scss",
"prepare": "husky install" "prepare": "husky install"
}, },
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
@ -71,7 +70,6 @@
"@tailwindcss/forms": "^0.5.9", "@tailwindcss/forms": "^0.5.9",
"@tailwindcss/typography": "^0.5.15", "@tailwindcss/typography": "^0.5.15",
"@tanstack/react-query": "^5.59.13", "@tanstack/react-query": "^5.59.13",
"@twemoji/svg": "^15.0.0",
"@types/escape-html": "^1.0.1", "@types/escape-html": "^1.0.1",
"@types/http-link-header": "^1.0.3", "@types/http-link-header": "^1.0.3",
"@types/leaflet": "^1.8.0", "@types/leaflet": "^1.8.0",
@ -88,7 +86,6 @@
"@types/react-swipeable-views": "^0.13.1", "@types/react-swipeable-views": "^0.13.1",
"@types/redux-mock-store": "^1.0.6", "@types/redux-mock-store": "^1.0.6",
"@types/semver": "^7.3.9", "@types/semver": "^7.3.9",
"@vitejs/plugin-react": "^4.3.1",
"@webbtc/webln-types": "^3.0.0", "@webbtc/webln-types": "^3.0.0",
"autoprefixer": "^10.4.15", "autoprefixer": "^10.4.15",
"axios": "^1.2.2", "axios": "^1.2.2",
@ -100,10 +97,9 @@
"comlink": "^4.4.1", "comlink": "^4.4.1",
"cssnano": "^6.0.0", "cssnano": "^6.0.0",
"detect-passive-events": "^2.0.0", "detect-passive-events": "^2.0.0",
"emoji-datasource": "15.0.1",
"emoji-mart": "^5.6.0", "emoji-mart": "^5.6.0",
"escape-html": "^1.0.3", "escape-html": "^1.0.3",
"eslint-plugin-formatjs": "^4.12.2", "eslint-plugin-formatjs": "^5.2.2",
"exifr": "^7.1.3", "exifr": "^7.1.3",
"graphemesplit": "^2.4.4", "graphemesplit": "^2.4.4",
"html-react-parser": "^5.0.0", "html-react-parser": "^5.0.0",
@ -131,7 +127,7 @@
"react-helmet": "^6.1.0", "react-helmet": "^6.1.0",
"react-hot-toast": "^2.4.0", "react-hot-toast": "^2.4.0",
"react-inlinesvg": "^4.0.0", "react-inlinesvg": "^4.0.0",
"react-intl": "^6.0.0", "react-intl": "^6.8.7",
"react-motion": "^0.5.2", "react-motion": "^0.5.2",
"react-overlays": "^0.9.0", "react-overlays": "^0.9.0",
"react-redux": "^9.0.4", "react-redux": "^9.0.4",
@ -153,13 +149,12 @@
"vite": "^5.4.8", "vite": "^5.4.8",
"vite-plugin-compile-time": "^0.2.1", "vite-plugin-compile-time": "^0.2.1",
"vite-plugin-html": "^3.2.2", "vite-plugin-html": "^3.2.2",
"vite-plugin-require": "^1.2.14",
"vite-plugin-static-copy": "^1.0.6", "vite-plugin-static-copy": "^1.0.6",
"zod": "^3.23.5", "zod": "^3.23.5",
"zustand": "^5.0.0" "zustand": "^5.0.0"
}, },
"devDependencies": { "devDependencies": {
"@formatjs/cli": "^6.2.0", "@formatjs/cli": "^6.3.8",
"@gitbeaker/node": "^35.8.0", "@gitbeaker/node": "^35.8.0",
"@jedmao/redux-mock-store": "^3.0.5", "@jedmao/redux-mock-store": "^3.0.5",
"@testing-library/jest-dom": "^6.1.3", "@testing-library/jest-dom": "^6.1.3",
@ -168,6 +163,7 @@
"@testing-library/user-event": "^14.5.1", "@testing-library/user-event": "^14.5.1",
"@typescript-eslint/eslint-plugin": "^7.0.0", "@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0", "@typescript-eslint/parser": "^7.0.0",
"@vitejs/plugin-react-swc": "^3.7.1",
"eslint": "^8.49.0", "eslint": "^8.49.0",
"eslint-import-resolver-typescript": "^3.6.0", "eslint-import-resolver-typescript": "^3.6.0",
"eslint-plugin-compat": "^4.2.0", "eslint-plugin-compat": "^4.2.0",
@ -182,17 +178,12 @@
"husky": "^9.0.0", "husky": "^9.0.0",
"jsdom": "^24.0.0", "jsdom": "^24.0.0",
"lint-staged": ">=10", "lint-staged": ">=10",
"rollup-plugin-visualizer": "^5.9.2", "rollup-plugin-visualizer": "^5.12.0",
"stylelint": "^16.10.0", "stylelint": "^16.10.0",
"stylelint-config-standard-scss": "^13.1.0", "stylelint-config-standard-scss": "^13.1.0",
"tailwindcss": "^3.4.13", "tailwindcss": "^3.4.13",
"vite-plugin-checker": "^0.8.0", "vite-plugin-checker": "^0.8.0",
"vite-plugin-pwa": "^0.20.5", "vite-plugin-pwa": "^0.20.5",
"vitest": "^2.1.1" "vitest": "^2.1.1"
},
"resolutions": {
"glob-parent": "^6.0.1",
"jsonwebtoken": "^9.0.0",
"loader-utils": "^2.0.3"
} }
} }

View File

@ -1,6 +1,6 @@
import { Gitlab } from '@gitbeaker/node'; import { Gitlab } from '@gitbeaker/node';
import { getChanges } from './lib/changelog'; import { getChanges } from './lib/changelog.ts';
const { const {
CI_COMMIT_TAG, CI_COMMIT_TAG,

View File

@ -1,43 +0,0 @@
import MockAdapter from 'axios-mock-adapter';
import { staticClient } from 'soapbox/api';
import { mockStore } from 'soapbox/jest/test-helpers';
import {
FETCH_ABOUT_PAGE_REQUEST,
FETCH_ABOUT_PAGE_SUCCESS,
FETCH_ABOUT_PAGE_FAIL,
fetchAboutPage,
} from './about';
describe('fetchAboutPage()', () => {
it('creates the expected actions on success', () => {
const mock = new MockAdapter(staticClient);
mock.onGet('/instance/about/index.html')
.reply(200, '<h1>Hello world</h1>');
const expectedActions = [
{ type: FETCH_ABOUT_PAGE_REQUEST, slug: 'index' },
{ type: FETCH_ABOUT_PAGE_SUCCESS, slug: 'index', html: '<h1>Hello world</h1>' },
];
const store = mockStore({});
return store.dispatch(fetchAboutPage()).then(() => {
expect(store.getActions()).toEqual(expectedActions);
});
});
it('creates the expected actions on failure', () => {
const expectedActions = [
{ 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({});
return store.dispatch(fetchAboutPage('asdf')).catch(() => {
expect(store.getActions()).toEqual(expectedActions);
});
});
});

View File

@ -1,7 +1,7 @@
import api from '../api'; import api from '../api/index.ts';
import type { AnyAction } from 'redux'; import type { AnyAction } from 'redux';
import type { RootState } from 'soapbox/store'; import type { RootState } from 'soapbox/store.ts';
const FETCH_ABOUT_PAGE_REQUEST = 'FETCH_ABOUT_PAGE_REQUEST'; const FETCH_ABOUT_PAGE_REQUEST = 'FETCH_ABOUT_PAGE_REQUEST';
const FETCH_ABOUT_PAGE_SUCCESS = 'FETCH_ABOUT_PAGE_SUCCESS'; const FETCH_ABOUT_PAGE_SUCCESS = 'FETCH_ABOUT_PAGE_SUCCESS';

View File

@ -1,7 +1,9 @@
import { __stub } from 'soapbox/api'; import { beforeEach, describe, expect, it } from 'vitest';
import { mockStore, rootState } from 'soapbox/jest/test-helpers';
import { submitAccountNote } from './account-notes'; import { __stub } from 'soapbox/api/index.ts';
import { mockStore, rootState } from 'soapbox/jest/test-helpers.tsx';
import { submitAccountNote } from './account-notes.ts';
describe('submitAccountNote()', () => { describe('submitAccountNote()', () => {
let store: ReturnType<typeof mockStore>; let store: ReturnType<typeof mockStore>;

View File

@ -1,7 +1,7 @@
import api from '../api'; import api from '../api/index.ts';
import type { AnyAction } from 'redux'; import type { AnyAction } from 'redux';
import type { RootState } from 'soapbox/store'; import type { RootState } from 'soapbox/store.ts';
const ACCOUNT_NOTE_SUBMIT_REQUEST = 'ACCOUNT_NOTE_SUBMIT_REQUEST'; const ACCOUNT_NOTE_SUBMIT_REQUEST = 'ACCOUNT_NOTE_SUBMIT_REQUEST';
const ACCOUNT_NOTE_SUBMIT_SUCCESS = 'ACCOUNT_NOTE_SUBMIT_SUCCESS'; const ACCOUNT_NOTE_SUBMIT_SUCCESS = 'ACCOUNT_NOTE_SUBMIT_SUCCESS';

View File

@ -1,10 +1,11 @@
import { Map as ImmutableMap } from 'immutable'; import { Map as ImmutableMap } from 'immutable';
import { beforeEach, describe, expect, it } from 'vitest';
import { __stub } from 'soapbox/api'; import { __stub } from 'soapbox/api/index.ts';
import { buildInstance, buildRelationship } from 'soapbox/jest/factory'; import { buildInstance, buildRelationship } from 'soapbox/jest/factory.ts';
import { mockStore, rootState } from 'soapbox/jest/test-helpers'; import { mockStore, rootState } from 'soapbox/jest/test-helpers.tsx';
import { normalizeAccount } from 'soapbox/normalizers'; import { normalizeAccount } from 'soapbox/normalizers/index.ts';
import { ListRecord, ReducerRecord } from 'soapbox/reducers/user-lists'; import { ListRecord, ReducerRecord } from 'soapbox/reducers/user-lists.ts';
import { import {
authorizeFollowRequest, authorizeFollowRequest,
@ -25,7 +26,7 @@ import {
unblockAccount, unblockAccount,
unmuteAccount, unmuteAccount,
unsubscribeAccount, unsubscribeAccount,
} from './accounts'; } from './accounts.ts';
let store: ReturnType<typeof mockStore>; let store: ReturnType<typeof mockStore>;

View File

@ -1,22 +1,22 @@
import { importEntities } from 'soapbox/entity-store/actions'; import { importEntities } from 'soapbox/entity-store/actions.ts';
import { Entities } from 'soapbox/entity-store/entities'; import { Entities } from 'soapbox/entity-store/entities.ts';
import { selectAccount } from 'soapbox/selectors'; import { selectAccount } from 'soapbox/selectors/index.ts';
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import { getFeatures, parseVersion, PLEROMA } from 'soapbox/utils/features'; import { getFeatures, parseVersion, PLEROMA } from 'soapbox/utils/features.ts';
import api, { getLinks } from '../api'; import api, { getLinks } from '../api/index.ts';
import { import {
importFetchedAccount, importFetchedAccount,
importFetchedAccounts, importFetchedAccounts,
importErrorWhileFetchingAccountByUsername, importErrorWhileFetchingAccountByUsername,
} from './importer'; } from './importer/index.ts';
import type { AxiosError, CancelToken } from 'axios'; import type { AxiosError, CancelToken } from 'axios';
import type { Map as ImmutableMap } from 'immutable'; import type { Map as ImmutableMap } from 'immutable';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity, Status } from 'soapbox/types/entities'; import type { APIEntity, Status } from 'soapbox/types/entities.ts';
import type { History } from 'soapbox/types/history'; import type { History } from 'soapbox/types/history.ts';
const ACCOUNT_CREATE_REQUEST = 'ACCOUNT_CREATE_REQUEST'; const ACCOUNT_CREATE_REQUEST = 'ACCOUNT_CREATE_REQUEST';
const ACCOUNT_CREATE_SUCCESS = 'ACCOUNT_CREATE_SUCCESS'; const ACCOUNT_CREATE_SUCCESS = 'ACCOUNT_CREATE_SUCCESS';

View File

@ -1,17 +1,16 @@
import { fetchRelationships } from 'soapbox/actions/accounts.ts';
import { importFetchedAccount, importFetchedAccounts, importFetchedStatuses } from 'soapbox/actions/importer/index.ts';
import { DittoInstanceCredentials } from 'soapbox/features/admin/manage-ditto-server.tsx';
import { accountIdsToAccts } from 'soapbox/selectors/index.ts';
import { filterBadges, getTagDiff } from 'soapbox/utils/badges.ts';
import { fetchRelationships } from 'soapbox/actions/accounts'; import api, { getLinks } from '../api/index.ts';
import { importFetchedAccount, importFetchedAccounts, importFetchedStatuses } from 'soapbox/actions/importer';
import { DittoInstanceCredentials } from 'soapbox/features/admin/manage-ditto-server';
import { accountIdsToAccts } from 'soapbox/selectors';
import { filterBadges, getTagDiff } from 'soapbox/utils/badges';
import api, { getLinks } from '../api'; import { fetchInstance } from './instance.ts';
import { fetchInstance } from './instance';
import type { AxiosResponse } from 'axios'; import type { AxiosResponse } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const ADMIN_CONFIG_FETCH_REQUEST = 'ADMIN_CONFIG_FETCH_REQUEST'; const ADMIN_CONFIG_FETCH_REQUEST = 'ADMIN_CONFIG_FETCH_REQUEST';
const ADMIN_CONFIG_FETCH_SUCCESS = 'ADMIN_CONFIG_FETCH_SUCCESS'; const ADMIN_CONFIG_FETCH_SUCCESS = 'ADMIN_CONFIG_FETCH_SUCCESS';

View File

@ -1,16 +1,16 @@
import { defineMessages } from 'react-intl'; import { defineMessages } from 'react-intl';
import toast from 'soapbox/toast'; import toast from 'soapbox/toast.tsx';
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import { getFeatures } from 'soapbox/utils/features'; import { getFeatures } from 'soapbox/utils/features.ts';
import api from '../api'; import api from '../api/index.ts';
import { importFetchedAccounts } from './importer'; import { importFetchedAccounts } from './importer/index.ts';
import { patchMeSuccess } from './me'; import { patchMeSuccess } from './me.ts';
import type { Account } from 'soapbox/schemas'; import type { Account } from 'soapbox/schemas/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
const ALIASES_FETCH_REQUEST = 'ALIASES_FETCH_REQUEST'; const ALIASES_FETCH_REQUEST = 'ALIASES_FETCH_REQUEST';
const ALIASES_FETCH_SUCCESS = 'ALIASES_FETCH_SUCCESS'; const ALIASES_FETCH_SUCCESS = 'ALIASES_FETCH_SUCCESS';

View File

@ -6,7 +6,7 @@
* @see module:soapbox/actions/auth * @see module:soapbox/actions/auth
*/ */
import { baseClient } from '../api'; import { baseClient } from '../api/index.ts';
import type { AnyAction } from 'redux'; import type { AnyAction } from 'redux';

View File

@ -9,28 +9,28 @@
import { defineMessages } from 'react-intl'; import { defineMessages } from 'react-intl';
import { createAccount } from 'soapbox/actions/accounts'; import { createAccount } from 'soapbox/actions/accounts.ts';
import { createApp } from 'soapbox/actions/apps'; import { createApp } from 'soapbox/actions/apps.ts';
import { fetchMeSuccess, fetchMeFail } from 'soapbox/actions/me'; import { fetchMeSuccess, fetchMeFail } from 'soapbox/actions/me.ts';
import { obtainOAuthToken, revokeOAuthToken } from 'soapbox/actions/oauth'; import { obtainOAuthToken, revokeOAuthToken } from 'soapbox/actions/oauth.ts';
import { startOnboarding } from 'soapbox/actions/onboarding'; import { startOnboarding } from 'soapbox/actions/onboarding.ts';
import { custom } from 'soapbox/custom'; import { custom } from 'soapbox/custom.ts';
import { queryClient } from 'soapbox/queries/client'; import { queryClient } from 'soapbox/queries/client.ts';
import { selectAccount } from 'soapbox/selectors'; import { selectAccount } from 'soapbox/selectors/index.ts';
import { unsetSentryAccount } from 'soapbox/sentry'; import { unsetSentryAccount } from 'soapbox/sentry.ts';
import KVStore from 'soapbox/storage/kv-store'; import KVStore from 'soapbox/storage/kv-store.ts';
import toast from 'soapbox/toast'; import toast from 'soapbox/toast.tsx';
import { getLoggedInAccount, parseBaseURL } from 'soapbox/utils/auth'; import { getLoggedInAccount, parseBaseURL } from 'soapbox/utils/auth.ts';
import sourceCode from 'soapbox/utils/code'; import sourceCode from 'soapbox/utils/code.ts';
import { normalizeUsername } from 'soapbox/utils/input'; import { normalizeUsername } from 'soapbox/utils/input.ts';
import { getScopes } from 'soapbox/utils/scopes'; import { getScopes } from 'soapbox/utils/scopes.ts';
import api, { baseClient } from '../api'; import api, { baseClient } from '../api/index.ts';
import { importFetchedAccount } from './importer'; import { importFetchedAccount } from './importer/index.ts';
import type { AxiosError } from 'axios'; import type { AxiosError } from 'axios';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
export const SWITCH_ACCOUNT = 'SWITCH_ACCOUNT'; export const SWITCH_ACCOUNT = 'SWITCH_ACCOUNT';

View File

@ -1,6 +1,6 @@
import api from '../api'; import api from '../api/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
export const BACKUPS_FETCH_REQUEST = 'BACKUPS_FETCH_REQUEST'; export const BACKUPS_FETCH_REQUEST = 'BACKUPS_FETCH_REQUEST';
export const BACKUPS_FETCH_SUCCESS = 'BACKUPS_FETCH_SUCCESS'; export const BACKUPS_FETCH_SUCCESS = 'BACKUPS_FETCH_SUCCESS';

View File

@ -1,8 +1,10 @@
import { __stub } from 'soapbox/api'; import { beforeEach, describe, expect, it } from 'vitest';
import { mockStore, rootState } from 'soapbox/jest/test-helpers';
import { ListRecord, ReducerRecord as UserListsRecord } from 'soapbox/reducers/user-lists';
import { expandBlocks, fetchBlocks } from './blocks'; import { __stub } from 'soapbox/api/index.ts';
import { mockStore, rootState } from 'soapbox/jest/test-helpers.tsx';
import { ListRecord, ReducerRecord as UserListsRecord } from 'soapbox/reducers/user-lists.ts';
import { expandBlocks, fetchBlocks } from './blocks.ts';
const account = { const account = {
acct: 'twoods', acct: 'twoods',

View File

@ -1,11 +1,11 @@
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import api, { getLinks } from '../api'; import api, { getLinks } from '../api/index.ts';
import { fetchRelationships } from './accounts'; import { fetchRelationships } from './accounts.ts';
import { importFetchedAccounts } from './importer'; import { importFetchedAccounts } from './importer/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
const BLOCKS_FETCH_REQUEST = 'BLOCKS_FETCH_REQUEST'; const BLOCKS_FETCH_REQUEST = 'BLOCKS_FETCH_REQUEST';
const BLOCKS_FETCH_SUCCESS = 'BLOCKS_FETCH_SUCCESS'; const BLOCKS_FETCH_SUCCESS = 'BLOCKS_FETCH_SUCCESS';

View File

@ -1,9 +1,9 @@
import api, { getLinks } from '../api'; import api, { getLinks } from '../api/index.ts';
import { importFetchedStatuses } from './importer'; import { importFetchedStatuses } from './importer/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const BOOKMARKED_STATUSES_FETCH_REQUEST = 'BOOKMARKED_STATUSES_FETCH_REQUEST'; const BOOKMARKED_STATUSES_FETCH_REQUEST = 'BOOKMARKED_STATUSES_FETCH_REQUEST';
const BOOKMARKED_STATUSES_FETCH_SUCCESS = 'BOOKMARKED_STATUSES_FETCH_SUCCESS'; const BOOKMARKED_STATUSES_FETCH_SUCCESS = 'BOOKMARKED_STATUSES_FETCH_SUCCESS';

View File

@ -1,12 +1,12 @@
import { List as ImmutableList, Map as ImmutableMap } from 'immutable'; import { List as ImmutableList, Map as ImmutableMap } from 'immutable';
import { getSettings, changeSetting } from 'soapbox/actions/settings'; import { getSettings, changeSetting } from 'soapbox/actions/settings.ts';
import { getFeatures } from 'soapbox/utils/features'; import { getFeatures } from 'soapbox/utils/features.ts';
import api, { getLinks } from '../api'; import api, { getLinks } from '../api/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { History } from 'soapbox/types/history'; import type { History } from 'soapbox/types/history.ts';
const CHATS_FETCH_REQUEST = 'CHATS_FETCH_REQUEST'; const CHATS_FETCH_REQUEST = 'CHATS_FETCH_REQUEST';
const CHATS_FETCH_SUCCESS = 'CHATS_FETCH_SUCCESS'; const CHATS_FETCH_SUCCESS = 'CHATS_FETCH_SUCCESS';

View File

@ -1,7 +1,7 @@
import { AppDispatch, RootState } from 'soapbox/store'; import { AppDispatch, RootState } from 'soapbox/store.ts';
import { getFeatures, parseVersion } from 'soapbox/utils/features'; import { getFeatures, parseVersion } from 'soapbox/utils/features.ts';
import type { Status } from 'soapbox/types/entities'; import type { Status } from 'soapbox/types/entities.ts';
export const COMPOSE_SET_STATUS = 'COMPOSE_SET_STATUS' as const; export const COMPOSE_SET_STATUS = 'COMPOSE_SET_STATUS' as const;

View File

@ -1,11 +1,12 @@
import { OrderedSet as ImmutableOrderedSet } from 'immutable'; import { OrderedSet as ImmutableOrderedSet } from 'immutable';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { buildInstance } from 'soapbox/jest/factory'; import { buildInstance } from 'soapbox/jest/factory.ts';
import { mockStore, rootState } from 'soapbox/jest/test-helpers'; import { mockStore, rootState } from 'soapbox/jest/test-helpers.tsx';
import { ReducerCompose } from 'soapbox/reducers/compose'; import { ReducerCompose } from 'soapbox/reducers/compose.ts';
import { uploadCompose, submitCompose } from './compose'; import { uploadCompose, submitCompose } from './compose.ts';
import { STATUS_CREATE_REQUEST } from './statuses'; import { STATUS_CREATE_REQUEST } from './statuses.ts';
import type { IntlShape } from 'react-intl'; import type { IntlShape } from 'react-intl';

View File

@ -3,31 +3,31 @@ import { List as ImmutableList } from 'immutable';
import throttle from 'lodash/throttle'; import throttle from 'lodash/throttle';
import { defineMessages, IntlShape } from 'react-intl'; import { defineMessages, IntlShape } from 'react-intl';
import api from 'soapbox/api'; import api from 'soapbox/api/index.ts';
import { isNativeEmoji } from 'soapbox/features/emoji'; import { isNativeEmoji } from 'soapbox/features/emoji/index.ts';
import emojiSearch from 'soapbox/features/emoji/search'; import emojiSearch from 'soapbox/features/emoji/search.ts';
import { normalizeTag } from 'soapbox/normalizers'; import { normalizeTag } from 'soapbox/normalizers/index.ts';
import { selectAccount, selectOwnAccount } from 'soapbox/selectors'; import { selectAccount, selectOwnAccount } from 'soapbox/selectors/index.ts';
import { tagHistory } from 'soapbox/settings'; import { tagHistory } from 'soapbox/settings.ts';
import toast from 'soapbox/toast'; import toast from 'soapbox/toast.tsx';
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import { getFeatures } from 'soapbox/utils/features'; import { getFeatures } from 'soapbox/utils/features.ts';
import { ComposeSetStatusAction } from './compose-status'; import { ComposeSetStatusAction } from './compose-status.ts';
import { chooseEmoji } from './emojis'; import { chooseEmoji } from './emojis.ts';
import { importFetchedAccounts } from './importer'; import { importFetchedAccounts } from './importer/index.ts';
import { uploadFile, updateMedia } from './media'; import { uploadFile, updateMedia } from './media.ts';
import { openModal, closeModal } from './modals'; import { openModal, closeModal } from './modals.ts';
import { getSettings } from './settings'; import { getSettings } from './settings.ts';
import { createStatus } from './statuses'; import { createStatus } from './statuses.ts';
import type { EditorState } from 'lexical'; import type { EditorState } from 'lexical';
import type { AutoSuggestion } from 'soapbox/components/autosuggest-input'; import type { AutoSuggestion } from 'soapbox/components/autosuggest-input.tsx';
import type { Emoji } from 'soapbox/features/emoji'; import type { Emoji } from 'soapbox/features/emoji/index.ts';
import type { Account, Group } from 'soapbox/schemas'; import type { Account, Group } from 'soapbox/schemas/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity, Status, Tag } from 'soapbox/types/entities'; import type { APIEntity, Status, Tag } from 'soapbox/types/entities.ts';
import type { History } from 'soapbox/types/history'; import type { History } from 'soapbox/types/history.ts';
const { CancelToken, isCancel } = axios; const { CancelToken, isCancel } = axios;

View File

@ -1,13 +1,13 @@
import axios from 'axios'; import axios from 'axios';
import * as BuildConfig from 'soapbox/build-config'; import * as BuildConfig from 'soapbox/build-config.ts';
import { isURL } from 'soapbox/utils/auth'; import { isURL } from 'soapbox/utils/auth.ts';
import sourceCode from 'soapbox/utils/code'; import sourceCode from 'soapbox/utils/code.ts';
import { getScopes } from 'soapbox/utils/scopes'; import { getScopes } from 'soapbox/utils/scopes.ts';
import { createApp } from './apps'; import { createApp } from './apps.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
const createProviderApp = () => { const createProviderApp = () => {
return async(dispatch: AppDispatch, getState: () => RootState) => { return async(dispatch: AppDispatch, getState: () => RootState) => {

View File

@ -1,15 +1,15 @@
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import api, { getLinks } from '../api'; import api, { getLinks } from '../api/index.ts';
import { import {
importFetchedAccounts, importFetchedAccounts,
importFetchedStatuses, importFetchedStatuses,
importFetchedStatus, importFetchedStatus,
} from './importer'; } from './importer/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const CONVERSATIONS_MOUNT = 'CONVERSATIONS_MOUNT'; const CONVERSATIONS_MOUNT = 'CONVERSATIONS_MOUNT';
const CONVERSATIONS_UNMOUNT = 'CONVERSATIONS_UNMOUNT'; const CONVERSATIONS_UNMOUNT = 'CONVERSATIONS_UNMOUNT';

View File

@ -1,7 +1,7 @@
import api from '../api'; import api from '../api/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const CUSTOM_EMOJIS_FETCH_REQUEST = 'CUSTOM_EMOJIS_FETCH_REQUEST'; const CUSTOM_EMOJIS_FETCH_REQUEST = 'CUSTOM_EMOJIS_FETCH_REQUEST';
const CUSTOM_EMOJIS_FETCH_SUCCESS = 'CUSTOM_EMOJIS_FETCH_SUCCESS'; const CUSTOM_EMOJIS_FETCH_SUCCESS = 'CUSTOM_EMOJIS_FETCH_SUCCESS';

View File

@ -1,10 +1,10 @@
import api from '../api'; import api from '../api/index.ts';
import { fetchRelationships } from './accounts'; import { fetchRelationships } from './accounts.ts';
import { importFetchedAccounts } from './importer'; import { importFetchedAccounts } from './importer/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const DIRECTORY_FETCH_REQUEST = 'DIRECTORY_FETCH_REQUEST'; const DIRECTORY_FETCH_REQUEST = 'DIRECTORY_FETCH_REQUEST';
const DIRECTORY_FETCH_SUCCESS = 'DIRECTORY_FETCH_SUCCESS'; const DIRECTORY_FETCH_SUCCESS = 'DIRECTORY_FETCH_SUCCESS';

View File

@ -1,11 +1,11 @@
import { Entities } from 'soapbox/entity-store/entities'; import { Entities } from 'soapbox/entity-store/entities.ts';
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import api, { getLinks } from '../api'; import api, { getLinks } from '../api/index.ts';
import type { EntityStore } from 'soapbox/entity-store/types'; import type { EntityStore } from 'soapbox/entity-store/types.ts';
import type { Account } from 'soapbox/schemas'; import type { Account } from 'soapbox/schemas/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
const DOMAIN_BLOCK_REQUEST = 'DOMAIN_BLOCK_REQUEST'; const DOMAIN_BLOCK_REQUEST = 'DOMAIN_BLOCK_REQUEST';
const DOMAIN_BLOCK_SUCCESS = 'DOMAIN_BLOCK_SUCCESS'; const DOMAIN_BLOCK_SUCCESS = 'DOMAIN_BLOCK_SUCCESS';

View File

@ -1,6 +1,6 @@
import api from '../api'; import api from '../api/index.ts';
import type { RootState } from 'soapbox/store'; import type { RootState } from 'soapbox/store.ts';
const getSubscribersCsv = () => const getSubscribersCsv = () =>
(dispatch: any, getState: () => RootState) => (dispatch: any, getState: () => RootState) =>

View File

@ -1,14 +1,14 @@
import { List as ImmutableList } from 'immutable'; import { List as ImmutableList } from 'immutable';
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import api from '../api'; import api from '../api/index.ts';
import { importFetchedAccounts, importFetchedStatus } from './importer'; import { importFetchedAccounts, importFetchedStatus } from './importer/index.ts';
import { favourite, unfavourite } from './interactions'; import { favourite, unfavourite } from './interactions.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity, EmojiReaction, Status } from 'soapbox/types/entities'; import type { APIEntity, EmojiReaction, Status } from 'soapbox/types/entities.ts';
const EMOJI_REACT_REQUEST = 'EMOJI_REACT_REQUEST'; const EMOJI_REACT_REQUEST = 'EMOJI_REACT_REQUEST';
const EMOJI_REACT_SUCCESS = 'EMOJI_REACT_SUCCESS'; const EMOJI_REACT_SUCCESS = 'EMOJI_REACT_SUCCESS';

View File

@ -1,7 +1,7 @@
import { saveSettings } from './settings'; import { saveSettings } from './settings.ts';
import type { Emoji } from 'soapbox/features/emoji'; import type { Emoji } from 'soapbox/features/emoji/index.ts';
import type { AppDispatch } from 'soapbox/store'; import type { AppDispatch } from 'soapbox/store.ts';
const EMOJI_CHOOSE = 'EMOJI_CHOOSE'; const EMOJI_CHOOSE = 'EMOJI_CHOOSE';

View File

@ -1,20 +1,20 @@
import { defineMessages, IntlShape } from 'react-intl'; import { defineMessages, IntlShape } from 'react-intl';
import api, { getLinks } from 'soapbox/api'; import api, { getLinks } from 'soapbox/api/index.ts';
import toast from 'soapbox/toast'; import toast from 'soapbox/toast.tsx';
import { importFetchedAccounts, importFetchedStatus, importFetchedStatuses } from './importer'; import { importFetchedAccounts, importFetchedStatus, importFetchedStatuses } from './importer/index.ts';
import { uploadFile } from './media'; import { uploadFile } from './media.ts';
import { closeModal, openModal } from './modals'; import { closeModal, openModal } from './modals.ts';
import { import {
STATUS_FETCH_SOURCE_FAIL, STATUS_FETCH_SOURCE_FAIL,
STATUS_FETCH_SOURCE_REQUEST, STATUS_FETCH_SOURCE_REQUEST,
STATUS_FETCH_SOURCE_SUCCESS, STATUS_FETCH_SOURCE_SUCCESS,
} from './statuses'; } from './statuses.ts';
import type { ReducerStatus } from 'soapbox/reducers/statuses'; import type { ReducerStatus } from 'soapbox/reducers/statuses.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity, Status as StatusEntity } from 'soapbox/types/entities'; import type { APIEntity, Status as StatusEntity } from 'soapbox/types/entities.ts';
const LOCATION_SEARCH_REQUEST = 'LOCATION_SEARCH_REQUEST' as const; const LOCATION_SEARCH_REQUEST = 'LOCATION_SEARCH_REQUEST' as const;
const LOCATION_SEARCH_SUCCESS = 'LOCATION_SEARCH_SUCCESS' as const; const LOCATION_SEARCH_SUCCESS = 'LOCATION_SEARCH_SUCCESS' as const;

View File

@ -1,11 +1,11 @@
import { defineMessages } from 'react-intl'; import { defineMessages } from 'react-intl';
import api, { getLinks } from 'soapbox/api'; import api, { getLinks } from 'soapbox/api/index.ts';
import { normalizeAccount } from 'soapbox/normalizers'; import { normalizeAccount } from 'soapbox/normalizers/index.ts';
import toast from 'soapbox/toast'; import toast from 'soapbox/toast.tsx';
import type { AxiosResponse } from 'axios'; import type { AxiosResponse } from 'axios';
import type { RootState } from 'soapbox/store'; import type { RootState } from 'soapbox/store.ts';
export const EXPORT_FOLLOWS_REQUEST = 'EXPORT_FOLLOWS_REQUEST'; export const EXPORT_FOLLOWS_REQUEST = 'EXPORT_FOLLOWS_REQUEST';
export const EXPORT_FOLLOWS_SUCCESS = 'EXPORT_FOLLOWS_SUCCESS'; export const EXPORT_FOLLOWS_SUCCESS = 'EXPORT_FOLLOWS_SUCCESS';

View File

@ -6,17 +6,17 @@
* @see module:soapbox/actions/oauth * @see module:soapbox/actions/oauth
*/ */
import { createApp } from 'soapbox/actions/apps'; import { createApp } from 'soapbox/actions/apps.ts';
import { authLoggedIn, verifyCredentials, switchAccount } from 'soapbox/actions/auth'; import { authLoggedIn, verifyCredentials, switchAccount } from 'soapbox/actions/auth.ts';
import { obtainOAuthToken } from 'soapbox/actions/oauth'; import { obtainOAuthToken } from 'soapbox/actions/oauth.ts';
import { InstanceV1, instanceV1Schema } from 'soapbox/schemas/instance'; import { InstanceV1, instanceV1Schema } from 'soapbox/schemas/instance.ts';
import { parseBaseURL } from 'soapbox/utils/auth'; import { parseBaseURL } from 'soapbox/utils/auth.ts';
import sourceCode from 'soapbox/utils/code'; import sourceCode from 'soapbox/utils/code.ts';
import { getInstanceScopes } from 'soapbox/utils/scopes'; import { getInstanceScopes } from 'soapbox/utils/scopes.ts';
import { baseClient } from '../api'; import { baseClient } from '../api/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
const fetchExternalInstance = (baseURL?: string) => { const fetchExternalInstance = (baseURL?: string) => {
return baseClient(null, baseURL) return baseClient(null, baseURL)

View File

@ -1,11 +1,11 @@
import { AppDispatch, RootState } from 'soapbox/store'; import { AppDispatch, RootState } from 'soapbox/store.ts';
import api from '../api'; import api from '../api/index.ts';
import { fetchRelationships } from './accounts'; import { fetchRelationships } from './accounts.ts';
import { importFetchedAccounts } from './importer'; import { importFetchedAccounts } from './importer/index.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
export const FAMILIAR_FOLLOWERS_FETCH_REQUEST = 'FAMILIAR_FOLLOWERS_FETCH_REQUEST'; export const FAMILIAR_FOLLOWERS_FETCH_REQUEST = 'FAMILIAR_FOLLOWERS_FETCH_REQUEST';
export const FAMILIAR_FOLLOWERS_FETCH_SUCCESS = 'FAMILIAR_FOLLOWERS_FETCH_SUCCESS'; export const FAMILIAR_FOLLOWERS_FETCH_SUCCESS = 'FAMILIAR_FOLLOWERS_FETCH_SUCCESS';

View File

@ -1,11 +1,11 @@
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import api, { getLinks } from '../api'; import api, { getLinks } from '../api/index.ts';
import { importFetchedStatuses } from './importer'; import { importFetchedStatuses } from './importer/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const FAVOURITED_STATUSES_FETCH_REQUEST = 'FAVOURITED_STATUSES_FETCH_REQUEST'; const FAVOURITED_STATUSES_FETCH_REQUEST = 'FAVOURITED_STATUSES_FETCH_REQUEST';
const FAVOURITED_STATUSES_FETCH_SUCCESS = 'FAVOURITED_STATUSES_FETCH_SUCCESS'; const FAVOURITED_STATUSES_FETCH_SUCCESS = 'FAVOURITED_STATUSES_FETCH_SUCCESS';

View File

@ -1,12 +1,12 @@
import { defineMessages } from 'react-intl'; import { defineMessages } from 'react-intl';
import toast from 'soapbox/toast'; import toast from 'soapbox/toast.tsx';
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import { getFeatures } from 'soapbox/utils/features'; import { getFeatures } from 'soapbox/utils/features.ts';
import api from '../api'; import api from '../api/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
const FILTERS_FETCH_REQUEST = 'FILTERS_FETCH_REQUEST'; const FILTERS_FETCH_REQUEST = 'FILTERS_FETCH_REQUEST';
const FILTERS_FETCH_SUCCESS = 'FILTERS_FETCH_SUCCESS'; const FILTERS_FETCH_SUCCESS = 'FILTERS_FETCH_SUCCESS';

View File

@ -1,13 +1,13 @@
import { deleteEntities } from 'soapbox/entity-store/actions'; import { deleteEntities } from 'soapbox/entity-store/actions.ts';
import api, { getLinks } from '../api'; import api, { getLinks } from '../api/index.ts';
import { fetchRelationships } from './accounts'; import { fetchRelationships } from './accounts.ts';
import { importFetchedGroups, importFetchedAccounts } from './importer'; import { importFetchedGroups, importFetchedAccounts } from './importer/index.ts';
import type { GroupRole } from 'soapbox/reducers/group-memberships'; import type { GroupRole } from 'soapbox/reducers/group-memberships.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const GROUP_CREATE_REQUEST = 'GROUP_CREATE_REQUEST'; const GROUP_CREATE_REQUEST = 'GROUP_CREATE_REQUEST';
const GROUP_CREATE_SUCCESS = 'GROUP_CREATE_SUCCESS'; const GROUP_CREATE_SUCCESS = 'GROUP_CREATE_SUCCESS';

View File

@ -1,9 +1,9 @@
import api from 'soapbox/api'; import api from 'soapbox/api/index.ts';
import { importFetchedAccounts } from './importer'; import { importFetchedAccounts } from './importer/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const HISTORY_FETCH_REQUEST = 'HISTORY_FETCH_REQUEST'; const HISTORY_FETCH_REQUEST = 'HISTORY_FETCH_REQUEST';
const HISTORY_FETCH_SUCCESS = 'HISTORY_FETCH_SUCCESS'; const HISTORY_FETCH_SUCCESS = 'HISTORY_FETCH_SUCCESS';

View File

@ -1,10 +1,10 @@
import { defineMessages } from 'react-intl'; import { defineMessages } from 'react-intl';
import toast from 'soapbox/toast'; import toast from 'soapbox/toast.tsx';
import api from '../api'; import api from '../api/index.ts';
import type { RootState } from 'soapbox/store'; import type { RootState } from 'soapbox/store.ts';
export const IMPORT_FOLLOWS_REQUEST = 'IMPORT_FOLLOWS_REQUEST'; export const IMPORT_FOLLOWS_REQUEST = 'IMPORT_FOLLOWS_REQUEST';
export const IMPORT_FOLLOWS_SUCCESS = 'IMPORT_FOLLOWS_SUCCESS'; export const IMPORT_FOLLOWS_SUCCESS = 'IMPORT_FOLLOWS_SUCCESS';

View File

@ -1,12 +1,12 @@
import { importEntities } from 'soapbox/entity-store/actions'; import { importEntities } from 'soapbox/entity-store/actions.ts';
import { Entities } from 'soapbox/entity-store/entities'; import { Entities } from 'soapbox/entity-store/entities.ts';
import { Group, accountSchema, groupSchema } from 'soapbox/schemas'; import { Group, accountSchema, groupSchema } from 'soapbox/schemas/index.ts';
import { filteredArray } from 'soapbox/schemas/utils'; import { filteredArray } from 'soapbox/schemas/utils.ts';
import { getSettings } from '../settings'; import { getSettings } from '../settings.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const ACCOUNT_IMPORT = 'ACCOUNT_IMPORT'; const ACCOUNT_IMPORT = 'ACCOUNT_IMPORT';
const ACCOUNTS_IMPORT = 'ACCOUNTS_IMPORT'; const ACCOUNTS_IMPORT = 'ACCOUNTS_IMPORT';

View File

@ -1,11 +1,11 @@
import { createAsyncThunk } from '@reduxjs/toolkit'; import { createAsyncThunk } from '@reduxjs/toolkit';
import { instanceV1Schema, instanceV2Schema } from 'soapbox/schemas/instance'; import { instanceV1Schema, instanceV2Schema } from 'soapbox/schemas/instance.ts';
import { RootState } from 'soapbox/store'; import { RootState } from 'soapbox/store.ts';
import { getAuthUserUrl, getMeUrl } from 'soapbox/utils/auth'; import { getAuthUserUrl, getMeUrl } from 'soapbox/utils/auth.ts';
import { getFeatures } from 'soapbox/utils/features'; import { getFeatures } from 'soapbox/utils/features.ts';
import api from '../api'; import api from '../api/index.ts';
/** Figure out the appropriate instance to fetch depending on the state */ /** Figure out the appropriate instance to fetch depending on the state */
export const getHost = (state: RootState) => { export const getHost = (state: RootState) => {

View File

@ -1,18 +1,18 @@
import { defineMessages } from 'react-intl'; import { defineMessages } from 'react-intl';
import toast, { type IToastOptions } from 'soapbox/toast'; import toast, { type IToastOptions } from 'soapbox/toast.tsx';
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import { getFeatures } from 'soapbox/utils/features'; import { getFeatures } from 'soapbox/utils/features.ts';
import api, { getLinks } from '../api'; import api, { getLinks } from '../api/index.ts';
import { fetchRelationships } from './accounts'; import { fetchRelationships } from './accounts.ts';
import { importFetchedAccounts, importFetchedStatus } from './importer'; import { importFetchedAccounts, importFetchedStatus } from './importer/index.ts';
import { openModal } from './modals'; import { openModal } from './modals.ts';
import { expandGroupFeaturedTimeline } from './timelines'; import { expandGroupFeaturedTimeline } from './timelines.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { Account as AccountEntity, APIEntity, Group, Status as StatusEntity } from 'soapbox/types/entities'; import type { Account as AccountEntity, APIEntity, Group, Status as StatusEntity } from 'soapbox/types/entities.ts';
const REBLOG_REQUEST = 'REBLOG_REQUEST'; const REBLOG_REQUEST = 'REBLOG_REQUEST';
const REBLOG_SUCCESS = 'REBLOG_SUCCESS'; const REBLOG_SUCCESS = 'REBLOG_SUCCESS';

View File

@ -1,13 +1,13 @@
import { selectAccount } from 'soapbox/selectors'; import { selectAccount } from 'soapbox/selectors/index.ts';
import toast from 'soapbox/toast'; import toast from 'soapbox/toast.tsx';
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import api from '../api'; import api from '../api/index.ts';
import { importFetchedAccounts } from './importer'; import { importFetchedAccounts } from './importer/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const LIST_FETCH_REQUEST = 'LIST_FETCH_REQUEST'; const LIST_FETCH_REQUEST = 'LIST_FETCH_REQUEST';
const LIST_FETCH_SUCCESS = 'LIST_FETCH_SUCCESS'; const LIST_FETCH_SUCCESS = 'LIST_FETCH_SUCCESS';

View File

@ -1,7 +1,7 @@
import api from '../api'; import api from '../api/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const MARKER_FETCH_REQUEST = 'MARKER_FETCH_REQUEST'; const MARKER_FETCH_REQUEST = 'MARKER_FETCH_REQUEST';
const MARKER_FETCH_SUCCESS = 'MARKER_FETCH_SUCCESS'; const MARKER_FETCH_SUCCESS = 'MARKER_FETCH_SUCCESS';

View File

@ -1,17 +1,17 @@
import { selectAccount } from 'soapbox/selectors'; import { selectAccount } from 'soapbox/selectors/index.ts';
import { setSentryAccount } from 'soapbox/sentry'; import { setSentryAccount } from 'soapbox/sentry.ts';
import KVStore from 'soapbox/storage/kv-store'; import KVStore from 'soapbox/storage/kv-store.ts';
import { getAuthUserId, getAuthUserUrl } from 'soapbox/utils/auth'; import { getAuthUserId, getAuthUserUrl } from 'soapbox/utils/auth.ts';
import api from '../api'; import api from '../api/index.ts';
import { loadCredentials } from './auth'; import { loadCredentials } from './auth.ts';
import { importFetchedAccount } from './importer'; import { importFetchedAccount } from './importer/index.ts';
import type { RawAxiosRequestHeaders } from 'axios'; import type { RawAxiosRequestHeaders } from 'axios';
import type { Account } from 'soapbox/schemas'; import type { Account } from 'soapbox/schemas/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const ME_FETCH_REQUEST = 'ME_FETCH_REQUEST' as const; const ME_FETCH_REQUEST = 'ME_FETCH_REQUEST' as const;
const ME_FETCH_SUCCESS = 'ME_FETCH_SUCCESS' as const; const ME_FETCH_SUCCESS = 'ME_FETCH_SUCCESS' as const;

View File

@ -1,15 +1,15 @@
import { defineMessages, type IntlShape } from 'react-intl'; import { defineMessages, type IntlShape } from 'react-intl';
import toast from 'soapbox/toast'; import toast from 'soapbox/toast.tsx';
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import { getFeatures } from 'soapbox/utils/features'; import { getFeatures } from 'soapbox/utils/features.ts';
import { formatBytes, getVideoDuration } from 'soapbox/utils/media'; import { formatBytes, getVideoDuration } from 'soapbox/utils/media.ts';
import resizeImage from 'soapbox/utils/resize-image'; import resizeImage from 'soapbox/utils/resize-image.ts';
import api from '../api'; import api from '../api/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const messages = defineMessages({ const messages = defineMessages({
exceededImageSizeLimit: { id: 'upload_error.image_size_limit', defaultMessage: 'Image exceeds the current file size limit ({limit})' }, exceededImageSizeLimit: { id: 'upload_error.image_size_limit', defaultMessage: 'Image exceeds the current file size limit ({limit})' },

View File

@ -1,6 +1,6 @@
import api from '../api'; import api from '../api/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
const MFA_FETCH_REQUEST = 'MFA_FETCH_REQUEST'; const MFA_FETCH_REQUEST = 'MFA_FETCH_REQUEST';
const MFA_FETCH_SUCCESS = 'MFA_FETCH_SUCCESS'; const MFA_FETCH_SUCCESS = 'MFA_FETCH_SUCCESS';

View File

@ -1,6 +1,6 @@
import { AppDispatch } from 'soapbox/store'; import { AppDispatch } from 'soapbox/store.ts';
import type { ModalType } from 'soapbox/features/ui/components/modal-root'; import type { ModalType } from 'soapbox/features/ui/components/modal-root.tsx';
export const MODAL_OPEN = 'MODAL_OPEN'; export const MODAL_OPEN = 'MODAL_OPEN';
export const MODAL_CLOSE = 'MODAL_CLOSE'; export const MODAL_CLOSE = 'MODAL_CLOSE';

View File

@ -1,16 +1,20 @@
import React from 'react'; import alertTriangleIcon from '@tabler/icons/outline/alert-triangle.svg';
import trashIcon from '@tabler/icons/outline/trash.svg';
import userMinusIcon from '@tabler/icons/outline/user-minus.svg';
import userOffIcon from '@tabler/icons/outline/user-off.svg';
import { defineMessages, IntlShape } from 'react-intl'; import { defineMessages, IntlShape } from 'react-intl';
import { fetchAccountByUsername } from 'soapbox/actions/accounts'; import { fetchAccountByUsername } from 'soapbox/actions/accounts.ts';
import { deactivateUsers, deleteUser, deleteStatus, toggleStatusSensitivity } from 'soapbox/actions/admin'; import { deactivateUsers, deleteUser, deleteStatus, toggleStatusSensitivity } from 'soapbox/actions/admin.ts';
import { openModal } from 'soapbox/actions/modals'; import { openModal } from 'soapbox/actions/modals.ts';
import OutlineBox from 'soapbox/components/outline-box'; import OutlineBox from 'soapbox/components/outline-box.tsx';
import { Stack, Text } from 'soapbox/components/ui'; import Stack from 'soapbox/components/ui/stack.tsx';
import AccountContainer from 'soapbox/containers/account-container'; import Text from 'soapbox/components/ui/text.tsx';
import { selectAccount } from 'soapbox/selectors'; import AccountContainer from 'soapbox/containers/account-container.tsx';
import toast from 'soapbox/toast'; import { selectAccount } from 'soapbox/selectors/index.ts';
import toast from 'soapbox/toast.tsx';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
const messages = defineMessages({ const messages = defineMessages({
deactivateUserHeading: { id: 'confirmations.admin.deactivate_user.heading', defaultMessage: 'Deactivate @{acct}' }, deactivateUserHeading: { id: 'confirmations.admin.deactivate_user.heading', defaultMessage: 'Deactivate @{acct}' },
@ -58,7 +62,7 @@ const deactivateUserModal = (intl: IntlShape, accountId: string, afterConfirm =
); );
dispatch(openModal('CONFIRM', { dispatch(openModal('CONFIRM', {
icon: require('@tabler/icons/outline/user-off.svg'), icon: userOffIcon,
heading: intl.formatMessage(messages.deactivateUserHeading, { acct }), heading: intl.formatMessage(messages.deactivateUserHeading, { acct }),
message, message,
confirm: intl.formatMessage(messages.deactivateUserConfirm, { name }), confirm: intl.formatMessage(messages.deactivateUserConfirm, { name }),
@ -96,7 +100,7 @@ const deleteUserModal = (intl: IntlShape, accountId: string, afterConfirm = () =
const checkbox = local ? intl.formatMessage(messages.deleteLocalUserCheckbox) : false; const checkbox = local ? intl.formatMessage(messages.deleteLocalUserCheckbox) : false;
dispatch(openModal('CONFIRM', { dispatch(openModal('CONFIRM', {
icon: require('@tabler/icons/outline/user-minus.svg'), icon: userMinusIcon,
heading: intl.formatMessage(messages.deleteUserHeading, { acct }), heading: intl.formatMessage(messages.deleteUserHeading, { acct }),
message, message,
confirm, confirm,
@ -118,7 +122,7 @@ const toggleStatusSensitivityModal = (intl: IntlShape, statusId: string, sensiti
const acct = state.statuses.get(statusId)!.account.acct; const acct = state.statuses.get(statusId)!.account.acct;
dispatch(openModal('CONFIRM', { dispatch(openModal('CONFIRM', {
icon: require('@tabler/icons/outline/alert-triangle.svg'), icon: alertTriangleIcon,
heading: intl.formatMessage(sensitive === false ? messages.markStatusSensitiveHeading : messages.markStatusNotSensitiveHeading), heading: intl.formatMessage(sensitive === false ? messages.markStatusSensitiveHeading : messages.markStatusNotSensitiveHeading),
message: intl.formatMessage(sensitive === false ? messages.markStatusSensitivePrompt : messages.markStatusNotSensitivePrompt, { acct }), message: intl.formatMessage(sensitive === false ? messages.markStatusSensitivePrompt : messages.markStatusNotSensitivePrompt, { acct }),
confirm: intl.formatMessage(sensitive === false ? messages.markStatusSensitiveConfirm : messages.markStatusNotSensitiveConfirm), confirm: intl.formatMessage(sensitive === false ? messages.markStatusSensitiveConfirm : messages.markStatusNotSensitiveConfirm),
@ -138,7 +142,7 @@ const deleteStatusModal = (intl: IntlShape, statusId: string, afterConfirm = ()
const acct = state.statuses.get(statusId)!.account.acct; const acct = state.statuses.get(statusId)!.account.acct;
dispatch(openModal('CONFIRM', { dispatch(openModal('CONFIRM', {
icon: require('@tabler/icons/outline/trash.svg'), icon: trashIcon,
heading: intl.formatMessage(messages.deleteStatusHeading), heading: intl.formatMessage(messages.deleteStatusHeading),
message: intl.formatMessage(messages.deleteStatusPrompt, { acct: <strong className='break-words'>{acct}</strong> }), message: intl.formatMessage(messages.deleteStatusPrompt, { acct: <strong className='break-words'>{acct}</strong> }),
confirm: intl.formatMessage(messages.deleteStatusConfirm), confirm: intl.formatMessage(messages.deleteStatusConfirm),

View File

@ -1,11 +1,11 @@
import { Set as ImmutableSet } from 'immutable'; import { Set as ImmutableSet } from 'immutable';
import ConfigDB from 'soapbox/utils/config-db'; import ConfigDB from 'soapbox/utils/config-db.ts';
import { fetchConfig, updateConfig } from './admin'; import { fetchConfig, updateConfig } from './admin.ts';
import type { MRFSimple } from 'soapbox/schemas/pleroma'; import type { MRFSimple } from 'soapbox/schemas/pleroma.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
const simplePolicyMerge = (simplePolicy: MRFSimple, host: string, restrictions: Record<string, any>) => { const simplePolicyMerge = (simplePolicy: MRFSimple, host: string, restrictions: Record<string, any>) => {
const entries = Object.entries(simplePolicy).map(([key, hosts]) => { const entries = Object.entries(simplePolicy).map(([key, hosts]) => {

View File

@ -1,8 +1,8 @@
import { openModal } from './modals'; import { openModal } from './modals.ts';
import type { Account } from 'soapbox/schemas'; import type { Account } from 'soapbox/schemas/index.ts';
import type { AppDispatch } from 'soapbox/store'; import type { AppDispatch } from 'soapbox/store.ts';
import type { Account as AccountEntity } from 'soapbox/types/entities'; import type { Account as AccountEntity } from 'soapbox/types/entities.ts';
const MUTES_INIT_MODAL = 'MUTES_INIT_MODAL'; const MUTES_INIT_MODAL = 'MUTES_INIT_MODAL';
const MUTES_TOGGLE_HIDE_NOTIFICATIONS = 'MUTES_TOGGLE_HIDE_NOTIFICATIONS'; const MUTES_TOGGLE_HIDE_NOTIFICATIONS = 'MUTES_TOGGLE_HIDE_NOTIFICATIONS';

View File

@ -1,13 +1,13 @@
import { NostrSigner, NRelay1, NSecSigner } from '@nostrify/nostrify'; import { NostrSigner, NRelay1, NSecSigner } from '@nostrify/nostrify';
import { generateSecretKey } from 'nostr-tools'; import { generateSecretKey } from 'nostr-tools';
import { NBunker } from 'soapbox/features/nostr/NBunker'; import { NBunker } from 'soapbox/features/nostr/NBunker.ts';
import { keyring } from 'soapbox/features/nostr/keyring'; import { keyring } from 'soapbox/features/nostr/keyring.ts';
import { useBunkerStore } from 'soapbox/hooks/nostr/useBunkerStore'; import { useBunkerStore } from 'soapbox/hooks/nostr/useBunkerStore.ts';
import { type AppDispatch } from 'soapbox/store'; import { type AppDispatch } from 'soapbox/store.ts';
import { authLoggedIn, verifyCredentials } from './auth'; import { authLoggedIn, verifyCredentials } from './auth.ts';
import { obtainOAuthToken } from './oauth'; import { obtainOAuthToken } from './oauth.ts';
const NOSTR_PUBKEY_SET = 'NOSTR_PUBKEY_SET'; const NOSTR_PUBKEY_SET = 'NOSTR_PUBKEY_SET';
@ -64,8 +64,6 @@ function logInNostr(signer: NostrSigner, relay: NRelay1) {
}); });
await dispatch(verifyCredentials(accessToken)); await dispatch(verifyCredentials(accessToken));
// TODO: get rid of `vite-plugin-require` and switch to `using` for the bunker. :(
bunker.close(); bunker.close();
}; };
} }

View File

@ -1,10 +1,11 @@
import { OrderedMap as ImmutableOrderedMap } from 'immutable'; import { OrderedMap as ImmutableOrderedMap } from 'immutable';
import { describe, expect, it } from 'vitest';
import { __stub } from 'soapbox/api'; import { __stub } from 'soapbox/api/index.ts';
import { mockStore, rootState } from 'soapbox/jest/test-helpers'; import { mockStore, rootState } from 'soapbox/jest/test-helpers.tsx';
import { normalizeNotification } from 'soapbox/normalizers'; import { normalizeNotification } from 'soapbox/normalizers/index.ts';
import { markReadNotifications } from './notifications'; import { markReadNotifications } from './notifications.ts';
describe('markReadNotifications()', () => { describe('markReadNotifications()', () => {
it('fires off marker when top notification is newer than lastRead', async() => { it('fires off marker when top notification is newer than lastRead', async() => {

View File

@ -2,28 +2,27 @@ import IntlMessageFormat from 'intl-messageformat';
import 'intl-pluralrules'; import 'intl-pluralrules';
import { defineMessages } from 'react-intl'; import { defineMessages } from 'react-intl';
import api, { getLinks } from 'soapbox/api'; import api, { getLinks } from 'soapbox/api/index.ts';
import { getFilters, regexFromFilters } from 'soapbox/selectors'; import { getFilters, regexFromFilters } from 'soapbox/selectors/index.ts';
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import { compareId } from 'soapbox/utils/comparators'; import { compareId } from 'soapbox/utils/comparators.ts';
import { getFeatures, parseVersion, PLEROMA } from 'soapbox/utils/features'; import { getFeatures, parseVersion, PLEROMA } from 'soapbox/utils/features.ts';
import { unescapeHTML } from 'soapbox/utils/html'; import { unescapeHTML } from 'soapbox/utils/html.ts';
import { EXCLUDE_TYPES, NOTIFICATION_TYPES } from 'soapbox/utils/notification'; import { EXCLUDE_TYPES, NOTIFICATION_TYPES } from 'soapbox/utils/notification.ts';
import { joinPublicPath } from 'soapbox/utils/static';
import { fetchRelationships } from './accounts'; import { fetchRelationships } from './accounts.ts';
import { fetchGroupRelationships } from './groups'; import { fetchGroupRelationships } from './groups.ts';
import { import {
importFetchedAccount, importFetchedAccount,
importFetchedAccounts, importFetchedAccounts,
importFetchedStatus, importFetchedStatus,
importFetchedStatuses, importFetchedStatuses,
} from './importer'; } from './importer/index.ts';
import { saveMarker } from './markers'; import { saveMarker } from './markers.ts';
import { getSettings, saveSettings } from './settings'; import { getSettings, saveSettings } from './settings.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity, Status } from 'soapbox/types/entities'; import type { APIEntity, Status } from 'soapbox/types/entities.ts';
const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE'; const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE';
const NOTIFICATIONS_UPDATE_NOOP = 'NOTIFICATIONS_UPDATE_NOOP'; const NOTIFICATIONS_UPDATE_NOOP = 'NOTIFICATIONS_UPDATE_NOOP';
@ -120,7 +119,7 @@ const updateNotificationsQueue = (notification: APIEntity, intlMessages: Record<
icon: notification.account.avatar, icon: notification.account.avatar,
tag: notification.id, tag: notification.id,
data: { data: {
url: joinPublicPath('/notifications'), url: '/notifications',
}, },
}).catch(console.error); }).catch(console.error);
}).catch(console.error); }).catch(console.error);

View File

@ -6,11 +6,11 @@
* @see module:soapbox/actions/auth * @see module:soapbox/actions/auth
*/ */
import { getBaseURL } from 'soapbox/utils/state'; import { getBaseURL } from 'soapbox/utils/state.ts';
import { baseClient } from '../api'; import { baseClient } from '../api/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
export const OAUTH_TOKEN_CREATE_REQUEST = 'OAUTH_TOKEN_CREATE_REQUEST'; export const OAUTH_TOKEN_CREATE_REQUEST = 'OAUTH_TOKEN_CREATE_REQUEST';
export const OAUTH_TOKEN_CREATE_SUCCESS = 'OAUTH_TOKEN_CREATE_SUCCESS'; export const OAUTH_TOKEN_CREATE_SUCCESS = 'OAUTH_TOKEN_CREATE_SUCCESS';

View File

@ -1,6 +1,8 @@
import { mockStore, mockWindowProperty, rootState } from 'soapbox/jest/test-helpers'; import { beforeEach, describe, expect, it, vi } from 'vitest';
import { checkOnboardingStatus, startOnboarding, endOnboarding } from './onboarding'; import { mockStore, mockWindowProperty, rootState } from 'soapbox/jest/test-helpers.tsx';
import { checkOnboardingStatus, startOnboarding, endOnboarding } from './onboarding.ts';
describe('checkOnboarding()', () => { describe('checkOnboarding()', () => {
let mockGetItem: any; let mockGetItem: any;

View File

@ -1,7 +1,7 @@
import api from '../api'; import api from '../api/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const PATRON_INSTANCE_FETCH_REQUEST = 'PATRON_INSTANCE_FETCH_REQUEST'; const PATRON_INSTANCE_FETCH_REQUEST = 'PATRON_INSTANCE_FETCH_REQUEST';
const PATRON_INSTANCE_FETCH_SUCCESS = 'PATRON_INSTANCE_FETCH_SUCCESS'; const PATRON_INSTANCE_FETCH_SUCCESS = 'PATRON_INSTANCE_FETCH_SUCCESS';

View File

@ -1,11 +1,11 @@
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import api from '../api'; import api from '../api/index.ts';
import { importFetchedStatuses } from './importer'; import { importFetchedStatuses } from './importer/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const PINNED_STATUSES_FETCH_REQUEST = 'PINNED_STATUSES_FETCH_REQUEST'; const PINNED_STATUSES_FETCH_REQUEST = 'PINNED_STATUSES_FETCH_REQUEST';
const PINNED_STATUSES_FETCH_SUCCESS = 'PINNED_STATUSES_FETCH_SUCCESS'; const PINNED_STATUSES_FETCH_SUCCESS = 'PINNED_STATUSES_FETCH_SUCCESS';

View File

@ -1,9 +1,9 @@
import api from '../api'; import api from '../api/index.ts';
import { importFetchedPoll } from './importer'; import { importFetchedPoll } from './importer/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const POLL_VOTE_REQUEST = 'POLL_VOTE_REQUEST'; const POLL_VOTE_REQUEST = 'POLL_VOTE_REQUEST';
const POLL_VOTE_SUCCESS = 'POLL_VOTE_SUCCESS'; const POLL_VOTE_SUCCESS = 'POLL_VOTE_SUCCESS';

View File

@ -1,12 +1,14 @@
import { __stub } from 'soapbox/api'; import { describe, expect, it } from 'vitest';
import { mockStore } from 'soapbox/jest/test-helpers';
import { VERIFY_CREDENTIALS_REQUEST } from './auth'; import { __stub } from 'soapbox/api/index.ts';
import { ACCOUNTS_IMPORT } from './importer'; import { mockStore } from 'soapbox/jest/test-helpers.tsx';
import { VERIFY_CREDENTIALS_REQUEST } from './auth.ts';
import { ACCOUNTS_IMPORT } from './importer/index.ts';
import { import {
MASTODON_PRELOAD_IMPORT, MASTODON_PRELOAD_IMPORT,
preloadMastodon, preloadMastodon,
} from './preload'; } from './preload.ts';
describe('preloadMastodon()', () => { describe('preloadMastodon()', () => {
it('creates the expected actions', async () => { it('creates the expected actions', async () => {

View File

@ -1,9 +1,9 @@
import mapValues from 'lodash/mapValues'; import mapValues from 'lodash/mapValues';
import { verifyCredentials } from './auth'; import { verifyCredentials } from './auth.ts';
import { importFetchedAccounts } from './importer'; import { importFetchedAccounts } from './importer/index.ts';
import type { AppDispatch } from 'soapbox/store'; import type { AppDispatch } from 'soapbox/store.ts';
const PLEROMA_PRELOAD_IMPORT = 'PLEROMA_PRELOAD_IMPORT'; const PLEROMA_PRELOAD_IMPORT = 'PLEROMA_PRELOAD_IMPORT';
const MASTODON_PRELOAD_IMPORT = 'MASTODON_PRELOAD_IMPORT'; const MASTODON_PRELOAD_IMPORT = 'MASTODON_PRELOAD_IMPORT';

View File

@ -1,8 +1,8 @@
/* eslint-disable compat/compat */ /* eslint-disable compat/compat */
import { HTTPError } from 'soapbox/api/HTTPError'; import { HTTPError } from 'soapbox/api/HTTPError.ts';
import { MastodonClient } from 'soapbox/api/MastodonClient'; import { MastodonClient } from 'soapbox/api/MastodonClient.ts';
import { WebPushSubscription, webPushSubscriptionSchema } from 'soapbox/schemas/web-push'; import { WebPushSubscription, webPushSubscriptionSchema } from 'soapbox/schemas/web-push.ts';
import { decodeBase64Url } from 'soapbox/utils/base64'; import { decodeBase64Url } from 'soapbox/utils/base64.ts';
// Last one checks for payload support: https://web-push-book.gauntface.com/chapter-06/01-non-standards-browsers/#no-payload // Last one checks for payload support: https://web-push-book.gauntface.com/chapter-06/01-non-standards-browsers/#no-payload
const supportsPushNotifications = ('serviceWorker' in navigator && 'PushManager' in window && 'getKey' in PushSubscription.prototype); const supportsPushNotifications = ('serviceWorker' in navigator && 'PushManager' in window && 'getKey' in PushSubscription.prototype);

View File

@ -1,7 +1,7 @@
import { getSettings, changeSetting } from 'soapbox/actions/settings'; import { getSettings, changeSetting } from 'soapbox/actions/settings.ts';
import type { List as ImmutableList, OrderedSet as ImmutableOrderedSet } from 'immutable'; import type { List as ImmutableList, OrderedSet as ImmutableOrderedSet } from 'immutable';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
const getPinnedHosts = (state: RootState) => { const getPinnedHosts = (state: RootState) => {
const settings = getSettings(state); const settings = getSettings(state);

View File

@ -1,10 +1,10 @@
import api from '../api'; import api from '../api/index.ts';
import { openModal } from './modals'; import { openModal } from './modals.ts';
import type { Account } from 'soapbox/schemas'; import type { Account } from 'soapbox/schemas/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { ChatMessage, Group, Status } from 'soapbox/types/entities'; import type { ChatMessage, Group, Status } from 'soapbox/types/entities.ts';
const REPORT_INIT = 'REPORT_INIT'; const REPORT_INIT = 'REPORT_INIT';
const REPORT_CANCEL = 'REPORT_CANCEL'; const REPORT_CANCEL = 'REPORT_CANCEL';

View File

@ -1,9 +1,9 @@
import { getFeatures } from 'soapbox/utils/features'; import { getFeatures } from 'soapbox/utils/features.ts';
import api, { getLinks } from '../api'; import api, { getLinks } from '../api/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const SCHEDULED_STATUSES_FETCH_REQUEST = 'SCHEDULED_STATUSES_FETCH_REQUEST'; const SCHEDULED_STATUSES_FETCH_REQUEST = 'SCHEDULED_STATUSES_FETCH_REQUEST';
const SCHEDULED_STATUSES_FETCH_SUCCESS = 'SCHEDULED_STATUSES_FETCH_SUCCESS'; const SCHEDULED_STATUSES_FETCH_SUCCESS = 'SCHEDULED_STATUSES_FETCH_SUCCESS';

View File

@ -1,11 +1,11 @@
import api, { getLinks } from '../api'; import api, { getLinks } from '../api/index.ts';
import { fetchRelationships } from './accounts'; import { fetchRelationships } from './accounts.ts';
import { importFetchedAccounts, importFetchedStatuses } from './importer'; import { importFetchedAccounts, importFetchedStatuses } from './importer/index.ts';
import type { SearchFilter } from 'soapbox/reducers/search'; import type { SearchFilter } from 'soapbox/reducers/search.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const SEARCH_CHANGE = 'SEARCH_CHANGE'; const SEARCH_CHANGE = 'SEARCH_CHANGE';
const SEARCH_CLEAR = 'SEARCH_CLEAR'; const SEARCH_CLEAR = 'SEARCH_CLEAR';

View File

@ -4,16 +4,16 @@
* @see module:soapbox/actions/auth * @see module:soapbox/actions/auth
*/ */
import toast from 'soapbox/toast'; import toast from 'soapbox/toast.tsx';
import { getLoggedInAccount } from 'soapbox/utils/auth'; import { getLoggedInAccount } from 'soapbox/utils/auth.ts';
import { parseVersion, TRUTHSOCIAL } from 'soapbox/utils/features'; import { parseVersion, TRUTHSOCIAL } from 'soapbox/utils/features.ts';
import { normalizeUsername } from 'soapbox/utils/input'; import { normalizeUsername } from 'soapbox/utils/input.ts';
import api from '../api'; import api from '../api/index.ts';
import { AUTH_LOGGED_OUT, messages } from './auth'; import { AUTH_LOGGED_OUT, messages } from './auth.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
const FETCH_TOKENS_REQUEST = 'FETCH_TOKENS_REQUEST'; const FETCH_TOKENS_REQUEST = 'FETCH_TOKENS_REQUEST';
const FETCH_TOKENS_SUCCESS = 'FETCH_TOKENS_SUCCESS'; const FETCH_TOKENS_SUCCESS = 'FETCH_TOKENS_SUCCESS';

View File

@ -2,12 +2,12 @@ import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
import { defineMessage } from 'react-intl'; import { defineMessage } from 'react-intl';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { patchMe } from 'soapbox/actions/me'; import { patchMe } from 'soapbox/actions/me.ts';
import messages from 'soapbox/messages'; import messages from 'soapbox/messages.ts';
import toast from 'soapbox/toast'; import toast from 'soapbox/toast.tsx';
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
const SETTING_CHANGE = 'SETTING_CHANGE' as const; const SETTING_CHANGE = 'SETTING_CHANGE' as const;
const SETTING_SAVE = 'SETTING_SAVE' as const; const SETTING_SAVE = 'SETTING_SAVE' as const;

View File

@ -1,15 +1,14 @@
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { getHost } from 'soapbox/actions/instance'; import { getHost } from 'soapbox/actions/instance.ts';
import { normalizeSoapboxConfig } from 'soapbox/normalizers'; import { normalizeSoapboxConfig } from 'soapbox/normalizers/index.ts';
import KVStore from 'soapbox/storage/kv-store'; import KVStore from 'soapbox/storage/kv-store.ts';
import { removeVS16s } from 'soapbox/utils/emoji'; import { getFeatures } from 'soapbox/utils/features.ts';
import { getFeatures } from 'soapbox/utils/features';
import api, { staticClient } from '../api'; import api from '../api/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const SOAPBOX_CONFIG_REQUEST_SUCCESS = 'SOAPBOX_CONFIG_REQUEST_SUCCESS'; const SOAPBOX_CONFIG_REQUEST_SUCCESS = 'SOAPBOX_CONFIG_REQUEST_SUCCESS';
const SOAPBOX_CONFIG_REQUEST_FAIL = 'SOAPBOX_CONFIG_REQUEST_FAIL'; const SOAPBOX_CONFIG_REQUEST_FAIL = 'SOAPBOX_CONFIG_REQUEST_FAIL';
@ -29,12 +28,6 @@ const getSoapboxConfig = createSelector([
if (soapbox.get('displayFqn') === undefined) { if (soapbox.get('displayFqn') === undefined) {
soapboxConfig.set('displayFqn', features.federating); soapboxConfig.set('displayFqn', features.federating);
} }
// If RGI reacts aren't supported, strip VS16s
// https://git.pleroma.social/pleroma/pleroma/-/issues/2355
if (features.emojiReactsNonRGI) {
soapboxConfig.set('allowedEmoji', soapboxConfig.allowedEmoji.map(removeVS16s));
}
}); });
}); });
@ -86,7 +79,7 @@ const loadSoapboxConfig = () =>
const fetchSoapboxJson = (host: string | null) => const fetchSoapboxJson = (host: string | null) =>
(dispatch: AppDispatch) => (dispatch: AppDispatch) =>
staticClient.get('/instance/soapbox.json').then(({ data }) => { fetch('/instance/soapbox.json').then((response) => response.json()).then((data) => {
if (!isObject(data)) throw 'soapbox.json failed'; if (!isObject(data)) throw 'soapbox.json failed';
dispatch(importSoapboxConfig(data, host)); dispatch(importSoapboxConfig(data, host));
return data; return data;

View File

@ -1,10 +1,11 @@
import { Map as ImmutableMap } from 'immutable'; import { Map as ImmutableMap } from 'immutable';
import { beforeEach, describe, expect, it } from 'vitest';
import { __stub } from 'soapbox/api'; import { __stub } from 'soapbox/api/index.ts';
import { mockStore, rootState } from 'soapbox/jest/test-helpers'; import { mockStore, rootState } from 'soapbox/jest/test-helpers.tsx';
import { StatusListRecord } from 'soapbox/reducers/status-lists'; import { StatusListRecord } from 'soapbox/reducers/status-lists.ts';
import { fetchStatusQuotes, expandStatusQuotes } from './status-quotes'; import { fetchStatusQuotes, expandStatusQuotes } from './status-quotes.ts';
const status = { const status = {
account: { account: {

View File

@ -1,8 +1,8 @@
import api, { getLinks } from '../api'; import api, { getLinks } from '../api/index.ts';
import { importFetchedStatuses } from './importer'; import { importFetchedStatuses } from './importer/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
export const STATUS_QUOTES_FETCH_REQUEST = 'STATUS_QUOTES_FETCH_REQUEST'; export const STATUS_QUOTES_FETCH_REQUEST = 'STATUS_QUOTES_FETCH_REQUEST';
export const STATUS_QUOTES_FETCH_SUCCESS = 'STATUS_QUOTES_FETCH_SUCCESS'; export const STATUS_QUOTES_FETCH_SUCCESS = 'STATUS_QUOTES_FETCH_SUCCESS';

View File

@ -1,11 +1,12 @@
import { fromJS, Map as ImmutableMap } from 'immutable'; import { fromJS, Map as ImmutableMap } from 'immutable';
import { beforeEach, describe, expect, it } from 'vitest';
import { STATUSES_IMPORT } from 'soapbox/actions/importer'; import { STATUSES_IMPORT } from 'soapbox/actions/importer/index.ts';
import { __stub } from 'soapbox/api'; import { __stub } from 'soapbox/api/index.ts';
import { mockStore, rootState } from 'soapbox/jest/test-helpers'; import { mockStore, rootState } from 'soapbox/jest/test-helpers.tsx';
import { normalizeStatus } from 'soapbox/normalizers/status'; import { normalizeStatus } from 'soapbox/normalizers/status.ts';
import { deleteStatus, fetchContext } from './statuses'; import { deleteStatus, fetchContext } from './statuses.ts';
describe('fetchContext()', () => { describe('fetchContext()', () => {
it('handles Mitra context', async () => { it('handles Mitra context', async () => {

View File

@ -1,17 +1,17 @@
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import { getFeatures } from 'soapbox/utils/features'; import { getFeatures } from 'soapbox/utils/features.ts';
import { shouldHaveCard } from 'soapbox/utils/status'; import { shouldHaveCard } from 'soapbox/utils/status.ts';
import api, { getNextLink } from '../api'; import api, { getNextLink } from '../api/index.ts';
import { setComposeToStatus } from './compose-status'; import { setComposeToStatus } from './compose-status.ts';
import { fetchGroupRelationships } from './groups'; import { fetchGroupRelationships } from './groups.ts';
import { importFetchedStatus, importFetchedStatuses } from './importer'; import { importFetchedStatus, importFetchedStatuses } from './importer/index.ts';
import { openModal } from './modals'; import { openModal } from './modals.ts';
import { deleteFromTimelines } from './timelines'; import { deleteFromTimelines } from './timelines.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity, Status } from 'soapbox/types/entities'; import type { APIEntity, Status } from 'soapbox/types/entities.ts';
const STATUS_CREATE_REQUEST = 'STATUS_CREATE_REQUEST'; const STATUS_CREATE_REQUEST = 'STATUS_CREATE_REQUEST';
const STATUS_CREATE_SUCCESS = 'STATUS_CREATE_SUCCESS'; const STATUS_CREATE_SUCCESS = 'STATUS_CREATE_SUCCESS';

View File

@ -1,33 +1,33 @@
import { getLocale, getSettings } from 'soapbox/actions/settings'; import { getLocale, getSettings } from 'soapbox/actions/settings.ts';
import { updateReactions } from 'soapbox/api/hooks/announcements/useAnnouncements'; import { updateReactions } from 'soapbox/api/hooks/announcements/useAnnouncements.ts';
import { importEntities } from 'soapbox/entity-store/actions'; import { importEntities } from 'soapbox/entity-store/actions.ts';
import { Entities } from 'soapbox/entity-store/entities'; import { Entities } from 'soapbox/entity-store/entities.ts';
import { selectEntity } from 'soapbox/entity-store/selectors'; import { selectEntity } from 'soapbox/entity-store/selectors.ts';
import messages from 'soapbox/messages'; import messages from 'soapbox/messages.ts';
import { ChatKeys, IChat, isLastMessage } from 'soapbox/queries/chats'; import { ChatKeys, IChat, isLastMessage } from 'soapbox/queries/chats.ts';
import { queryClient } from 'soapbox/queries/client'; import { queryClient } from 'soapbox/queries/client.ts';
import { announcementSchema, type Announcement, type Relationship } from 'soapbox/schemas'; import { announcementSchema, type Announcement, type Relationship } from 'soapbox/schemas/index.ts';
import { getUnreadChatsCount, updateChatListItem, updateChatMessage } from 'soapbox/utils/chats'; import { getUnreadChatsCount, updateChatListItem, updateChatMessage } from 'soapbox/utils/chats.ts';
import { removePageItem } from 'soapbox/utils/queries'; import { removePageItem } from 'soapbox/utils/queries.ts';
import { play, soundCache } from 'soapbox/utils/sounds'; import { play, soundCache } from 'soapbox/utils/sounds.ts';
import { connectStream } from '../stream'; import { connectStream } from '../stream.ts';
import { updateConversations } from './conversations'; import { updateConversations } from './conversations.ts';
import { fetchFilters } from './filters'; import { fetchFilters } from './filters.ts';
import { MARKER_FETCH_SUCCESS } from './markers'; import { MARKER_FETCH_SUCCESS } from './markers.ts';
import { updateNotificationsQueue } from './notifications'; import { updateNotificationsQueue } from './notifications.ts';
import { updateStatus } from './statuses'; import { updateStatus } from './statuses.ts';
import { import {
// deleteFromTimelines, // deleteFromTimelines,
connectTimeline, connectTimeline,
disconnectTimeline, disconnectTimeline,
processTimelineUpdate, processTimelineUpdate,
} from './timelines'; } from './timelines.ts';
import type { IStatContext } from 'soapbox/contexts/stat-context'; import type { IStatContext } from 'soapbox/contexts/stat-context.tsx';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity, Chat } from 'soapbox/types/entities'; import type { APIEntity, Chat } from 'soapbox/types/entities.ts';
const STREAMING_CHAT_UPDATE = 'STREAMING_CHAT_UPDATE'; const STREAMING_CHAT_UPDATE = 'STREAMING_CHAT_UPDATE';

View File

@ -1,14 +1,14 @@
import { isLoggedIn } from 'soapbox/utils/auth'; import { isLoggedIn } from 'soapbox/utils/auth.ts';
import { getFeatures } from 'soapbox/utils/features'; import { getFeatures } from 'soapbox/utils/features.ts';
import api, { getLinks } from '../api'; import api, { getLinks } from '../api/index.ts';
import { fetchRelationships } from './accounts'; import { fetchRelationships } from './accounts.ts';
import { importFetchedAccounts } from './importer'; import { importFetchedAccounts } from './importer/index.ts';
import { insertSuggestionsIntoTimeline } from './timelines'; import { insertSuggestionsIntoTimeline } from './timelines.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const SUGGESTIONS_FETCH_REQUEST = 'SUGGESTIONS_FETCH_REQUEST'; const SUGGESTIONS_FETCH_REQUEST = 'SUGGESTIONS_FETCH_REQUEST';
const SUGGESTIONS_FETCH_SUCCESS = 'SUGGESTIONS_FETCH_SUCCESS'; const SUGGESTIONS_FETCH_SUCCESS = 'SUGGESTIONS_FETCH_SUCCESS';

View File

@ -1,7 +1,7 @@
import api, { getLinks } from '../api'; import api, { getLinks } from '../api/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const HASHTAG_FETCH_REQUEST = 'HASHTAG_FETCH_REQUEST'; const HASHTAG_FETCH_REQUEST = 'HASHTAG_FETCH_REQUEST';
const HASHTAG_FETCH_SUCCESS = 'HASHTAG_FETCH_SUCCESS'; const HASHTAG_FETCH_SUCCESS = 'HASHTAG_FETCH_SUCCESS';

View File

@ -1,16 +1,16 @@
import { Map as ImmutableMap, OrderedSet as ImmutableOrderedSet } from 'immutable'; import { Map as ImmutableMap, OrderedSet as ImmutableOrderedSet } from 'immutable';
import { getSettings } from 'soapbox/actions/settings'; import { getSettings } from 'soapbox/actions/settings.ts';
import { normalizeStatus } from 'soapbox/normalizers'; import { normalizeStatus } from 'soapbox/normalizers/index.ts';
import { shouldFilter } from 'soapbox/utils/timelines'; import { shouldFilter } from 'soapbox/utils/timelines.ts';
import api, { getNextLink, getPrevLink } from '../api'; import api, { getNextLink, getPrevLink } from '../api/index.ts';
import { fetchGroupRelationships } from './groups'; import { fetchGroupRelationships } from './groups.ts';
import { importFetchedStatus, importFetchedStatuses } from './importer'; import { importFetchedStatus, importFetchedStatuses } from './importer/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity, Status } from 'soapbox/types/entities'; import type { APIEntity, Status } from 'soapbox/types/entities.ts';
const TIMELINE_UPDATE = 'TIMELINE_UPDATE' as const; const TIMELINE_UPDATE = 'TIMELINE_UPDATE' as const;
const TIMELINE_DELETE = 'TIMELINE_DELETE' as const; const TIMELINE_DELETE = 'TIMELINE_DELETE' as const;

View File

@ -1,11 +1,11 @@
import { APIEntity } from 'soapbox/types/entities'; import { APIEntity } from 'soapbox/types/entities.ts';
import { getFeatures } from 'soapbox/utils/features'; import { getFeatures } from 'soapbox/utils/features.ts';
import api, { getLinks } from '../api'; import api, { getLinks } from '../api/index.ts';
import { importFetchedStatuses } from './importer'; import { importFetchedStatuses } from './importer/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
const TRENDING_STATUSES_FETCH_REQUEST = 'TRENDING_STATUSES_FETCH_REQUEST'; const TRENDING_STATUSES_FETCH_REQUEST = 'TRENDING_STATUSES_FETCH_REQUEST';
const TRENDING_STATUSES_FETCH_SUCCESS = 'TRENDING_STATUSES_FETCH_SUCCESS'; const TRENDING_STATUSES_FETCH_SUCCESS = 'TRENDING_STATUSES_FETCH_SUCCESS';

View File

@ -1,7 +1,7 @@
import api from '../api'; import api from '../api/index.ts';
import type { AppDispatch, RootState } from 'soapbox/store'; import type { AppDispatch, RootState } from 'soapbox/store.ts';
import type { APIEntity } from 'soapbox/types/entities'; import type { APIEntity } from 'soapbox/types/entities.ts';
const TRENDS_FETCH_REQUEST = 'TRENDS_FETCH_REQUEST'; const TRENDS_FETCH_REQUEST = 'TRENDS_FETCH_REQUEST';
const TRENDS_FETCH_SUCCESS = 'TRENDS_FETCH_SUCCESS'; const TRENDS_FETCH_SUCCESS = 'TRENDS_FETCH_SUCCESS';

View File

@ -1,4 +1,5 @@
import { HTTPError } from './HTTPError'; import { HTTPError } from './HTTPError.ts';
import { MastodonResponse } from './MastodonResponse.ts';
interface Opts { interface Opts {
searchParams?: URLSearchParams | Record<string, string | number | boolean>; searchParams?: URLSearchParams | Record<string, string | number | boolean>;
@ -19,35 +20,35 @@ export class MastodonClient {
this.accessToken = accessToken; this.accessToken = accessToken;
} }
async get(path: string, opts: Opts = {}): Promise<Response> { async get(path: string, opts: Opts = {}): Promise<MastodonResponse> {
return this.request('GET', path, undefined, opts); return this.request('GET', path, undefined, opts);
} }
async post(path: string, data?: unknown, opts: Opts = {}): Promise<Response> { async post(path: string, data?: unknown, opts: Opts = {}): Promise<MastodonResponse> {
return this.request('POST', path, data, opts); return this.request('POST', path, data, opts);
} }
async put(path: string, data?: unknown, opts: Opts = {}): Promise<Response> { async put(path: string, data?: unknown, opts: Opts = {}): Promise<MastodonResponse> {
return this.request('PUT', path, data, opts); return this.request('PUT', path, data, opts);
} }
async delete(path: string, opts: Opts = {}): Promise<Response> { async delete(path: string, opts: Opts = {}): Promise<MastodonResponse> {
return this.request('DELETE', path, undefined, opts); return this.request('DELETE', path, undefined, opts);
} }
async patch(path: string, data: unknown, opts: Opts = {}): Promise<Response> { async patch(path: string, data: unknown, opts: Opts = {}): Promise<MastodonResponse> {
return this.request('PATCH', path, data, opts); return this.request('PATCH', path, data, opts);
} }
async head(path: string, opts: Opts = {}): Promise<Response> { async head(path: string, opts: Opts = {}): Promise<MastodonResponse> {
return this.request('HEAD', path, undefined, opts); return this.request('HEAD', path, undefined, opts);
} }
async options(path: string, opts: Opts = {}): Promise<Response> { async options(path: string, opts: Opts = {}): Promise<MastodonResponse> {
return this.request('OPTIONS', path, undefined, opts); return this.request('OPTIONS', path, undefined, opts);
} }
async request(method: string, path: string, data: unknown, opts: Opts = {}): Promise<Response> { async request(method: string, path: string, data: unknown, opts: Opts = {}): Promise<MastodonResponse> {
const url = new URL(path, this.baseUrl); const url = new URL(path, this.baseUrl);
if (opts.searchParams) { if (opts.searchParams) {
@ -89,7 +90,13 @@ export class MastodonClient {
throw new HTTPError(response, request); throw new HTTPError(response, request);
} }
return response; // Fix for non-compliant browsers.
// https://developer.mozilla.org/en-US/docs/Web/API/Response/body
if (response.status === 204 || request.method === 'HEAD') {
return new MastodonResponse(null, response);
}
return new MastodonResponse(response.body, response);
} }
} }

View File

@ -0,0 +1,16 @@
import LinkHeader from 'http-link-header';
export class MastodonResponse extends Response {
/** Parses the `Link` header and returns URLs for the `prev` and `next` pages of this response, if any. */
pagination(): { prev?: string; next?: string } {
const header = this.headers.get('link');
const links = header ? new LinkHeader(header) : undefined;
return {
next: links?.refs.find((link) => link.rel === 'next')?.uri,
prev: links?.refs.find((link) => link.rel === 'prev')?.uri,
};
}
}

View File

@ -15,8 +15,6 @@ const setupMock = (axios: AxiosInstance) => {
mocks.map(func => func(mock)); mocks.map(func => func(mock));
}; };
export const staticClient = api.staticClient;
export const getLinks = (response: AxiosResponse): LinkHeader => { export const getLinks = (response: AxiosResponse): LinkHeader => {
return new LinkHeader(response.headers?.link); return new LinkHeader(response.headers?.link);
}; };

View File

@ -1,12 +1,14 @@
import { useEffect, useMemo } from 'react'; import { useEffect, useMemo } from 'react';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { Entities } from 'soapbox/entity-store/entities'; import { Entities } from 'soapbox/entity-store/entities.ts';
import { useEntity } from 'soapbox/entity-store/hooks'; import { useEntity } from 'soapbox/entity-store/hooks/index.ts';
import { useApi, useFeatures, useLoggedIn } from 'soapbox/hooks'; import { useApi } from 'soapbox/hooks/useApi.ts';
import { type Account, accountSchema } from 'soapbox/schemas'; import { useFeatures } from 'soapbox/hooks/useFeatures.ts';
import { useLoggedIn } from 'soapbox/hooks/useLoggedIn.ts';
import { type Account, accountSchema } from 'soapbox/schemas/index.ts';
import { useRelationship } from './useRelationship'; import { useRelationship } from './useRelationship.ts';
interface UseAccountOpts { interface UseAccountOpts {
withRelationship?: boolean; withRelationship?: boolean;

View File

@ -1,11 +1,11 @@
import { Entities } from 'soapbox/entity-store/entities'; import { Entities } from 'soapbox/entity-store/entities.ts';
import { useEntities } from 'soapbox/entity-store/hooks'; import { useEntities } from 'soapbox/entity-store/hooks/index.ts';
import { useApi } from 'soapbox/hooks'; import { useApi } from 'soapbox/hooks/useApi.ts';
import { Account, accountSchema } from 'soapbox/schemas'; import { Account, accountSchema } from 'soapbox/schemas/index.ts';
import { useRelationships } from './useRelationships'; import { useRelationships } from './useRelationships.ts';
import type { EntityFn } from 'soapbox/entity-store/hooks/types'; import type { EntityFn } from 'soapbox/entity-store/hooks/types.ts';
interface useAccountListOpts { interface useAccountListOpts {
enabled?: boolean; enabled?: boolean;

View File

@ -1,12 +1,14 @@
import { useEffect } from 'react'; import { useEffect } from 'react';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { Entities } from 'soapbox/entity-store/entities'; import { Entities } from 'soapbox/entity-store/entities.ts';
import { useEntityLookup } from 'soapbox/entity-store/hooks'; import { useEntityLookup } from 'soapbox/entity-store/hooks/index.ts';
import { useApi, useFeatures, useLoggedIn } from 'soapbox/hooks'; import { useApi } from 'soapbox/hooks/useApi.ts';
import { type Account, accountSchema } from 'soapbox/schemas'; import { useFeatures } from 'soapbox/hooks/useFeatures.ts';
import { useLoggedIn } from 'soapbox/hooks/useLoggedIn.ts';
import { type Account, accountSchema } from 'soapbox/schemas/index.ts';
import { useRelationship } from './useRelationship'; import { useRelationship } from './useRelationship.ts';
interface UseAccountLookupOpts { interface UseAccountLookupOpts {
withRelationship?: boolean; withRelationship?: boolean;

View File

@ -1,8 +1,10 @@
import { importEntities } from 'soapbox/entity-store/actions'; import { importEntities } from 'soapbox/entity-store/actions.ts';
import { Entities } from 'soapbox/entity-store/entities'; import { Entities } from 'soapbox/entity-store/entities.ts';
import { useTransaction } from 'soapbox/entity-store/hooks'; import { useTransaction } from 'soapbox/entity-store/hooks/index.ts';
import { useApi, useAppDispatch, useLoggedIn } from 'soapbox/hooks'; import { useApi } from 'soapbox/hooks/useApi.ts';
import { relationshipSchema } from 'soapbox/schemas'; import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts';
import { useLoggedIn } from 'soapbox/hooks/useLoggedIn.ts';
import { relationshipSchema } from 'soapbox/schemas/index.ts';
interface FollowOpts { interface FollowOpts {
reblogs?: boolean; reblogs?: boolean;

View File

@ -1,8 +1,8 @@
import { Entities } from 'soapbox/entity-store/entities'; import { Entities } from 'soapbox/entity-store/entities.ts';
import { useEntity } from 'soapbox/entity-store/hooks'; import { useEntity } from 'soapbox/entity-store/hooks/index.ts';
import { useApi } from 'soapbox/hooks'; import { useApi } from 'soapbox/hooks/useApi.ts';
import { useSoapboxConfig } from 'soapbox/hooks/useSoapboxConfig'; import { useSoapboxConfig } from 'soapbox/hooks/useSoapboxConfig.ts';
import { type PatronUser, patronUserSchema } from 'soapbox/schemas'; import { type PatronUser, patronUserSchema } from 'soapbox/schemas/index.ts';
function usePatronUser(url?: string) { function usePatronUser(url?: string) {
const api = useApi(); const api = useApi();

View File

@ -1,9 +1,9 @@
import { z } from 'zod'; import { z } from 'zod';
import { Entities } from 'soapbox/entity-store/entities'; import { Entities } from 'soapbox/entity-store/entities.ts';
import { useEntity } from 'soapbox/entity-store/hooks'; import { useEntity } from 'soapbox/entity-store/hooks/index.ts';
import { useApi } from 'soapbox/hooks'; import { useApi } from 'soapbox/hooks/useApi.ts';
import { type Relationship, relationshipSchema } from 'soapbox/schemas'; import { type Relationship, relationshipSchema } from 'soapbox/schemas/index.ts';
interface UseRelationshipOpts { interface UseRelationshipOpts {
enabled?: boolean; enabled?: boolean;

View File

@ -1,7 +1,8 @@
import { Entities } from 'soapbox/entity-store/entities'; import { Entities } from 'soapbox/entity-store/entities.ts';
import { useBatchedEntities } from 'soapbox/entity-store/hooks/useBatchedEntities'; import { useBatchedEntities } from 'soapbox/entity-store/hooks/useBatchedEntities.ts';
import { useApi, useLoggedIn } from 'soapbox/hooks'; import { useApi } from 'soapbox/hooks/useApi.ts';
import { type Relationship, relationshipSchema } from 'soapbox/schemas'; import { useLoggedIn } from 'soapbox/hooks/useLoggedIn.ts';
import { type Relationship, relationshipSchema } from 'soapbox/schemas/index.ts';
function useRelationships(listKey: string[], ids: string[]) { function useRelationships(listKey: string[], ids: string[]) {
const api = useApi(); const api = useApi();

View File

@ -1,6 +1,6 @@
export { useDomains } from './useDomains'; export { useDomains } from './useDomains.ts';
export { useModerationLog } from './useModerationLog'; export { useModerationLog } from './useModerationLog.ts';
export { useRelays } from './useRelays'; export { useRelays } from './useRelays.ts';
export { useRules } from './useRules'; export { useRules } from './useRules.ts';
export { useSuggest } from './useSuggest'; export { useSuggest } from './useSuggest.ts';
export { useVerify } from './useVerify'; export { useVerify } from './useVerify.ts';

View File

@ -1,7 +1,7 @@
import { Entities } from 'soapbox/entity-store/entities'; import { Entities } from 'soapbox/entity-store/entities.ts';
import { useEntities } from 'soapbox/entity-store/hooks'; import { useEntities } from 'soapbox/entity-store/hooks/index.ts';
import { useApi } from 'soapbox/hooks'; import { useApi } from 'soapbox/hooks/useApi.ts';
import { adminAccountSchema } from 'soapbox/schemas/admin-account'; import { adminAccountSchema } from 'soapbox/schemas/admin-account.ts';
interface MastodonAdminFilters { interface MastodonAdminFilters {
local?: boolean; local?: boolean;

View File

@ -1,10 +1,10 @@
import { useMutation, useQuery } from '@tanstack/react-query'; import { useMutation, useQuery } from '@tanstack/react-query';
import { useApi } from 'soapbox/hooks'; import { useApi } from 'soapbox/hooks/useApi.ts';
import { queryClient } from 'soapbox/queries/client'; import { queryClient } from 'soapbox/queries/client.ts';
import { adminAnnouncementSchema, type AdminAnnouncement } from 'soapbox/schemas'; import { adminAnnouncementSchema, type AdminAnnouncement } from 'soapbox/schemas/index.ts';
import { useAnnouncements as useUserAnnouncements } from '../announcements'; import { useAnnouncements as useUserAnnouncements } from '../announcements/index.ts';
interface CreateAnnouncementParams { interface CreateAnnouncementParams {
content: string; content: string;

View File

@ -1,7 +1,7 @@
import { Entities } from 'soapbox/entity-store/entities'; import { Entities } from 'soapbox/entity-store/entities.ts';
import { useCreateEntity } from 'soapbox/entity-store/hooks'; import { useCreateEntity } from 'soapbox/entity-store/hooks/index.ts';
import { useApi } from 'soapbox/hooks'; import { useApi } from 'soapbox/hooks/useApi.ts';
import { domainSchema } from 'soapbox/schemas'; import { domainSchema } from 'soapbox/schemas/index.ts';
interface CreateDomainParams { interface CreateDomainParams {
domain: string; domain: string;

View File

@ -1,6 +1,6 @@
import { Entities } from 'soapbox/entity-store/entities'; import { Entities } from 'soapbox/entity-store/entities.ts';
import { useDeleteEntity } from 'soapbox/entity-store/hooks'; import { useDeleteEntity } from 'soapbox/entity-store/hooks/index.ts';
import { useApi } from 'soapbox/hooks'; import { useApi } from 'soapbox/hooks/useApi.ts';
const useDeleteDomain = () => { const useDeleteDomain = () => {
const api = useApi(); const api = useApi();

View File

@ -1,8 +1,8 @@
import { useMutation, useQuery } from '@tanstack/react-query'; import { useMutation, useQuery } from '@tanstack/react-query';
import { useApi } from 'soapbox/hooks'; import { useApi } from 'soapbox/hooks/useApi.ts';
import { queryClient } from 'soapbox/queries/client'; import { queryClient } from 'soapbox/queries/client.ts';
import { domainSchema, type Domain } from 'soapbox/schemas'; import { domainSchema, type Domain } from 'soapbox/schemas/index.ts';
interface CreateDomainParams { interface CreateDomainParams {
domain: string; domain: string;

View File

@ -1,10 +1,10 @@
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
import { defineMessages } from 'react-intl'; import { defineMessages } from 'react-intl';
import { type INewAccount } from 'soapbox/features/admin/manage-zap-split'; import { type INewAccount } from 'soapbox/features/admin/manage-zap-split.tsx';
import { useApi } from 'soapbox/hooks'; import { useApi } from 'soapbox/hooks/useApi.ts';
import { baseZapAccountSchema, ZapSplitData } from 'soapbox/schemas/zap-split'; import { baseZapAccountSchema, ZapSplitData } from 'soapbox/schemas/zap-split.ts';
import toast from 'soapbox/toast'; import toast from 'soapbox/toast.tsx';
const messages = defineMessages({ const messages = defineMessages({

View File

@ -1,7 +1,7 @@
import { useInfiniteQuery } from '@tanstack/react-query'; import { useInfiniteQuery } from '@tanstack/react-query';
import { useApi } from 'soapbox/hooks'; import { useApi } from 'soapbox/hooks/useApi.ts';
import { moderationLogEntrySchema, type ModerationLogEntry } from 'soapbox/schemas'; import { moderationLogEntrySchema, type ModerationLogEntry } from 'soapbox/schemas/index.ts';
interface ModerationLogResult { interface ModerationLogResult {
items: ModerationLogEntry[]; items: ModerationLogEntry[];

View File

@ -1,8 +1,8 @@
import { useMutation, useQuery } from '@tanstack/react-query'; import { useMutation, useQuery } from '@tanstack/react-query';
import { useApi } from 'soapbox/hooks'; import { useApi } from 'soapbox/hooks/useApi.ts';
import { queryClient } from 'soapbox/queries/client'; import { queryClient } from 'soapbox/queries/client.ts';
import { relaySchema, type Relay } from 'soapbox/schemas'; import { relaySchema, type Relay } from 'soapbox/schemas/index.ts';
const useRelays = () => { const useRelays = () => {
const api = useApi(); const api = useApi();

View File

@ -1,8 +1,8 @@
import { useMutation, useQuery } from '@tanstack/react-query'; import { useMutation, useQuery } from '@tanstack/react-query';
import { useApi } from 'soapbox/hooks'; import { useApi } from 'soapbox/hooks/useApi.ts';
import { queryClient } from 'soapbox/queries/client'; import { queryClient } from 'soapbox/queries/client.ts';
import { adminRuleSchema, type AdminRule } from 'soapbox/schemas'; import { adminRuleSchema, type AdminRule } from 'soapbox/schemas/index.ts';
interface CreateRuleParams { interface CreateRuleParams {
priority?: number; priority?: number;

Some files were not shown because too many files have changed in this diff Show More