mirror of
https://github.com/wassname/talk.git
synced 2026-06-27 17:32:25 +08:00
[CORL-1074] Upgrade dependencies (#2999)
* chore: upgrade eslint, typescript * chore: upgrade deps * chore: revert upgrade ts-node-dev * chore: revert unneeded comments Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
+30
-9
@@ -1,7 +1,7 @@
|
||||
const typescriptEslintRecommended = require("@typescript-eslint/eslint-plugin/dist/configs/eslint-recommended")
|
||||
.default.overrides[0];
|
||||
const typescriptRecommended = require("@typescript-eslint/eslint-plugin/dist/configs/recommended.json");
|
||||
const typescriptRecommendedTypeChecking = require("@typescript-eslint/eslint-plugin/dist/configs/recommended-requiring-type-checking.json");
|
||||
.overrides[0];
|
||||
const typescriptRecommended = require("@typescript-eslint/eslint-plugin/dist/configs/recommended.js");
|
||||
const typescriptRecommendedTypeChecking = require("@typescript-eslint/eslint-plugin/dist/configs/recommended-requiring-type-checking.js");
|
||||
const typescriptEslintPrettier = require("eslint-config-prettier/@typescript-eslint");
|
||||
const react = require("eslint-plugin-react").configs.recommended;
|
||||
const jsxA11y = require("eslint-plugin-jsx-a11y").configs.recommended;
|
||||
@@ -41,12 +41,21 @@ const typescriptOverrides = {
|
||||
"error",
|
||||
{ default: "array-simple", readonly: "generic" },
|
||||
],
|
||||
"@typescript-eslint/ban-types": "error",
|
||||
"@typescript-eslint/ban-types": [
|
||||
"error",
|
||||
{
|
||||
types: {
|
||||
"{}": false,
|
||||
object: false,
|
||||
extendDefaults: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/camelcase": "off",
|
||||
"@typescript-eslint/consistent-type-assertions": "error",
|
||||
"@typescript-eslint/consistent-type-definitions": "error",
|
||||
"@typescript-eslint/class-name-casing": "error",
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
"@typescript-eslint/explicit-member-accessibility": [
|
||||
"error",
|
||||
{
|
||||
@@ -56,7 +65,6 @@ const typescriptOverrides = {
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/indent": "off",
|
||||
"@typescript-eslint/interface-name-prefix": "error",
|
||||
"@typescript-eslint/member-delimiter-style": "off",
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"@typescript-eslint/no-empty-interface": "error",
|
||||
@@ -64,7 +72,6 @@ const typescriptOverrides = {
|
||||
"@typescript-eslint/no-misused-new": "error",
|
||||
"@typescript-eslint/no-namespace": "error",
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"@typescript-eslint/no-parameter-properties": "off",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{ args: "none", ignoreRestSiblings: true },
|
||||
@@ -89,7 +96,14 @@ const typescriptOverrides = {
|
||||
),
|
||||
};
|
||||
|
||||
let typescriptTypeCheckingOverrides = {
|
||||
const jestTypeCheckingOverrides = {
|
||||
files: ["test/**/*.ts", "test/**/*.tsx"],
|
||||
rules: {
|
||||
"@typescript-eslint/no-floating-promises": "off",
|
||||
},
|
||||
};
|
||||
|
||||
const typescriptTypeCheckingOverrides = {
|
||||
files: ["*.ts", "*.tsx"],
|
||||
parserOptions: {
|
||||
project: [
|
||||
@@ -116,12 +130,18 @@ let typescriptTypeCheckingOverrides = {
|
||||
},
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/no-misused-promises": "off",
|
||||
"@typescript-eslint/no-unsafe-assignment": "off",
|
||||
"@typescript-eslint/no-unsafe-member-access": "off",
|
||||
"@typescript-eslint/no-unsafe-call": "off",
|
||||
"@typescript-eslint/no-unsafe-return": "off",
|
||||
// 28.11.19: (cvle) Disabled because behavior of regexp.exec seems different than str.match?
|
||||
"@typescript-eslint/prefer-regexp-exec": "off",
|
||||
"@typescript-eslint/require-await": "off",
|
||||
"@typescript-eslint/no-misused-promises": "off",
|
||||
"@typescript-eslint/restrict-template-expressions": "off",
|
||||
"@typescript-eslint/unbound-method": "off", // 10.10.19: (cvle) seems to give false positive.
|
||||
}),
|
||||
overrides: [jestTypeCheckingOverrides],
|
||||
};
|
||||
|
||||
const jestOverrides = {
|
||||
@@ -169,6 +189,7 @@ module.exports = {
|
||||
"eol-last": "off",
|
||||
eqeqeq: "error",
|
||||
"guard-for-in": "error",
|
||||
"jsdoc/check-param-names": "off",
|
||||
"jsdoc/require-jsdoc": "off",
|
||||
"jsdoc/require-returns": "off",
|
||||
"jsdoc/require-param": "off",
|
||||
|
||||
Generated
+5991
-5220
File diff suppressed because it is too large
Load Diff
+43
-40
@@ -148,11 +148,11 @@
|
||||
"xregexp": "^4.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.9.0",
|
||||
"@babel/preset-env": "^7.9.0",
|
||||
"@babel/preset-react": "^7.9.4",
|
||||
"@babel/preset-typescript": "^7.9.0",
|
||||
"@babel/runtime-corejs3": "^7.9.2",
|
||||
"@babel/core": "^7.10.3",
|
||||
"@babel/preset-env": "^7.10.3",
|
||||
"@babel/preset-react": "^7.10.1",
|
||||
"@babel/preset-typescript": "^7.10.1",
|
||||
"@babel/runtime-corejs3": "^7.10.3",
|
||||
"@coralproject/npm-run-all": "^4.1.5",
|
||||
"@coralproject/rte": "^1.0.0",
|
||||
"@fluent/react": "^0.11.1",
|
||||
@@ -188,9 +188,9 @@
|
||||
"@types/html-minifier": "^3.5.3",
|
||||
"@types/html-minifier-terser": "^5.0.0",
|
||||
"@types/html-to-text": "^1.4.31",
|
||||
"@types/html-webpack-plugin": "^3.2.2",
|
||||
"@types/html-webpack-plugin": "^3.2.3",
|
||||
"@types/ioredis": "^4.14.9",
|
||||
"@types/jest": "^25.2.1",
|
||||
"@types/jest": "^26.0.3",
|
||||
"@types/jest-axe": "^3.2.2",
|
||||
"@types/jsdom": "^16.2.0",
|
||||
"@types/jsonwebtoken": "^8.3.8",
|
||||
@@ -234,22 +234,22 @@
|
||||
"@types/uuid": "^7.0.2",
|
||||
"@types/verror": "^1.10.3",
|
||||
"@types/vinyl": "^2.0.4",
|
||||
"@types/webpack": "^4.41.10",
|
||||
"@types/webpack-assets-manifest": "^3.0.0",
|
||||
"@types/webpack-bundle-analyzer": "^2.13.3",
|
||||
"@types/webpack-dev-server": "^3.10.1",
|
||||
"@types/webpack": "^4.41.17",
|
||||
"@types/webpack-assets-manifest": "^3.0.1",
|
||||
"@types/webpack-bundle-analyzer": "^3.8.0",
|
||||
"@types/webpack-dev-server": "^3.11.0",
|
||||
"@types/ws": "^7.2.3",
|
||||
"@types/xregexp": "^4.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "^2.26.0",
|
||||
"@typescript-eslint/eslint-plugin-tslint": "^2.26.0",
|
||||
"@typescript-eslint/parser": "^2.26.0",
|
||||
"@typescript-eslint/eslint-plugin": "^3.4.0",
|
||||
"@typescript-eslint/eslint-plugin-tslint": "^3.4.0",
|
||||
"@typescript-eslint/parser": "^3.4.0",
|
||||
"autoprefixer": "^9.7.5",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"babel-jest": "^25.2.4",
|
||||
"babel-jest": "^26.1.0",
|
||||
"babel-loader": "^8.1.0",
|
||||
"babel-plugin-lodash": "^3.3.4",
|
||||
"babel-plugin-module-resolver": "^4.0.0",
|
||||
"babel-plugin-relay": "^9.0.0",
|
||||
"babel-plugin-relay": "^9.1.0",
|
||||
"babel-plugin-use-lodash-es": "^0.2.0",
|
||||
"bowser": "^2.9.0",
|
||||
"case-sensitive-paths-webpack-plugin": "^2.3.0",
|
||||
@@ -269,13 +269,13 @@
|
||||
"docz": "^v2.3.0-alpha.14",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.2",
|
||||
"enzyme-to-json": "^3.4.4",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-prettier": "^6.10.1",
|
||||
"eslint-plugin-jsdoc": "^22.1.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.2.3",
|
||||
"eslint-plugin-prettier": "^3.1.2",
|
||||
"eslint-plugin-react": "^7.19.0",
|
||||
"enzyme-to-json": "^3.5.0",
|
||||
"eslint": "^7.3.1",
|
||||
"eslint-config-prettier": "^6.11.0",
|
||||
"eslint-plugin-jsdoc": "^28.5.1",
|
||||
"eslint-plugin-jsx-a11y": "^6.3.1",
|
||||
"eslint-plugin-prettier": "^3.1.4",
|
||||
"eslint-plugin-react": "^7.20.0",
|
||||
"eventemitter2": "^6.3.1",
|
||||
"farce": "^0.2.8",
|
||||
"final-form": "4.18.6",
|
||||
@@ -285,23 +285,23 @@
|
||||
"fork-ts-checker-webpack-plugin": "^4.1.2",
|
||||
"found": "^0.4.10",
|
||||
"found-relay": "^0.7.0",
|
||||
"graphql-schema-linter": "^0.2.4",
|
||||
"graphql-schema-linter": "^0.4.0",
|
||||
"graphql-schema-typescript": "^1.3.2",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-babel": "^8.0.0",
|
||||
"gulp-cli": "^2.2.0",
|
||||
"gulp-cli": "^2.3.0",
|
||||
"gulp-sourcemaps": "^2.6.5",
|
||||
"gulp-typescript": "^6.0.0-alpha.1",
|
||||
"html-webpack-plugin": "^4.0.4",
|
||||
"husky": "^4.2.3",
|
||||
"intersection-observer": "^0.7.0",
|
||||
"jest": "^26.0.1",
|
||||
"jest": "^26.1.0",
|
||||
"jest-axe": "^3.4.0",
|
||||
"jest-junit": "^10.0.0",
|
||||
"jest-junit": "^11.0.1",
|
||||
"jest-localstorage-mock": "^2.4.2",
|
||||
"jest-mock-console": "^1.0.0",
|
||||
"jest-mock-console": "^1.0.1",
|
||||
"keymaster": "^1.6.2",
|
||||
"lint-staged": "^10.1.1",
|
||||
"lint-staged": "^10.2.11",
|
||||
"loader-utils": "^2.0.0",
|
||||
"lodash-es": "^4.17.15",
|
||||
"marked": "^0.8.2",
|
||||
@@ -341,7 +341,7 @@
|
||||
"recompose": "^0.30.0",
|
||||
"regenerator-runtime": "^0.13.5",
|
||||
"relay-compiler": "^9.0.0",
|
||||
"relay-compiler-language-typescript": "^12.0.0",
|
||||
"relay-compiler-language-typescript": "^12.0.3",
|
||||
"relay-local-schema": "^0.8.0",
|
||||
"relay-runtime": "^9.0.0",
|
||||
"resize-observer-polyfill": "^1.5.1",
|
||||
@@ -358,29 +358,32 @@
|
||||
"terser-webpack-plugin": "^2.3.5",
|
||||
"thread-loader": "^2.1.3",
|
||||
"timekeeper": "^2.2.0",
|
||||
"ts-jest": "25.4.0",
|
||||
"ts-loader": "^6.2.2",
|
||||
"ts-node": "^8.8.1",
|
||||
"ts-node-dev": "^1.0.0-pre.44",
|
||||
"ts-jest": "26.1.1",
|
||||
"ts-loader": "^7.0.5",
|
||||
"ts-node": "^8.10.2",
|
||||
"ts-node-dev": "1.0.0-pre.44",
|
||||
"tsconfig-paths": "^3.9.0",
|
||||
"tsconfig-paths-webpack-plugin": "^3.2.0",
|
||||
"tslint": "^6.1.0",
|
||||
"tslint": "^6.1.2",
|
||||
"typed-css-modules": "^0.6.3",
|
||||
"typeface-manuale": "^1.1.4",
|
||||
"typeface-nunito": "^1.1.3",
|
||||
"typeface-open-sans": "^0.0.75",
|
||||
"typeface-source-sans-pro": "^1.1.5",
|
||||
"typescript": "^3.8.3",
|
||||
"typescript": "^3.9.5",
|
||||
"typescript-snapshots-plugin": "^1.7.0",
|
||||
"wait-for-expect": "^1.3.0",
|
||||
"webpack": "^4.42.1",
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-assets-manifest": "^3.1.1",
|
||||
"webpack-bundle-analyzer": "^3.6.1",
|
||||
"webpack-cli": "^3.3.11",
|
||||
"webpack-dev-server": "^3.10.3",
|
||||
"webpack-bundle-analyzer": "^3.8.0",
|
||||
"webpack-cli": "^3.3.12",
|
||||
"webpack-dev-server": "^3.11.0",
|
||||
"whatwg-fetch": "^3.0.0"
|
||||
},
|
||||
"dependencies-pins-documentation": {
|
||||
"ts-node-dev@1.0.0-pre.44": [
|
||||
"Newer versions unbearibly slow"
|
||||
],
|
||||
"ts-jest@25.4.0": [
|
||||
"Newer versions require every definition file to be included",
|
||||
"in tsconfig.json in the `files` field. This is cumbersome and",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env ts-node
|
||||
|
||||
import dotenv from "dotenv";
|
||||
|
||||
// Apply all the configuration provided in the .env file if it isn't already in
|
||||
|
||||
@@ -76,7 +76,7 @@ export default class CommandExecutor implements Executor {
|
||||
});
|
||||
}
|
||||
|
||||
public execute(filePath: string) {
|
||||
public execute(filePath: string): void {
|
||||
this.spawnProcessPotentiallyDebounced();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,14 +99,14 @@ export default class LongRunningExecutor implements Executor {
|
||||
}
|
||||
|
||||
// This is called before exiting.
|
||||
public async onCleanup() {
|
||||
public async onCleanup(): Promise<void> {
|
||||
this.restartDebounced.cancel();
|
||||
if (this.isRunning) {
|
||||
await this.kill();
|
||||
}
|
||||
}
|
||||
|
||||
public execute(filePath: string) {
|
||||
public execute(filePath: string): void {
|
||||
if (this.isRunning) {
|
||||
this.restartDebounced();
|
||||
return;
|
||||
|
||||
@@ -80,7 +80,10 @@ function filterOnly(
|
||||
}) as Config["watchers"];
|
||||
}
|
||||
|
||||
export default async function watch(config: Config, options: Options = {}) {
|
||||
export default async function watch(
|
||||
config: Config,
|
||||
options: Options = {}
|
||||
): Promise<void> {
|
||||
Joi.assert(config, configSchema);
|
||||
const watcher: Watcher = config.backend || new SaneWatcher();
|
||||
const rootDir = config.rootDir || process.cwd();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import convict from "convict";
|
||||
import os from "os";
|
||||
|
||||
import { LOCALES } from "../common/helpers/i18n/locales";
|
||||
|
||||
@@ -67,7 +68,7 @@ const config = convict({
|
||||
maxCores: {
|
||||
doc: "Set maximum of available cores",
|
||||
format: "nat",
|
||||
default: require("os").cpus().length,
|
||||
default: os.cpus().length,
|
||||
env: "WEBPACK_MAX_CORES",
|
||||
arg: "maxCores",
|
||||
},
|
||||
|
||||
@@ -30,4 +30,4 @@ async function main() {
|
||||
ReactDOM.render(<Index />, document.getElementById("app"));
|
||||
}
|
||||
|
||||
main();
|
||||
void main();
|
||||
|
||||
@@ -136,7 +136,7 @@ const ModerateCardContainer: FunctionComponent<Props> = ({
|
||||
|
||||
const { storyID, siteID, section } = parseModerationOptions(match);
|
||||
|
||||
featureComment({
|
||||
void featureComment({
|
||||
commentID: comment.id,
|
||||
commentRevisionID: comment.revision.id,
|
||||
storyID,
|
||||
@@ -146,7 +146,7 @@ const ModerateCardContainer: FunctionComponent<Props> = ({
|
||||
}, [featureComment, comment, match]);
|
||||
|
||||
const handleUnfeature = useCallback(() => {
|
||||
unfeatureComment({
|
||||
void unfeatureComment({
|
||||
commentID: comment.id,
|
||||
storyID: match.params.storyID,
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ const ModeratorNote: FunctionComponent<Props> = ({
|
||||
}) => {
|
||||
const deleteNote = useCallback(() => {
|
||||
if (onDelete) {
|
||||
onDelete(id);
|
||||
void onDelete(id);
|
||||
}
|
||||
}, [id]);
|
||||
return (
|
||||
|
||||
@@ -33,7 +33,7 @@ const UserHistoryDrawerAllComments: FunctionComponent<Props> = ({
|
||||
return;
|
||||
}
|
||||
|
||||
loadMore();
|
||||
void loadMore();
|
||||
}, [loadMore]);
|
||||
|
||||
const hasMore = relay.hasMore();
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ const UserHistoryDrawerRejectedComments: FunctionComponent<Props> = ({
|
||||
return;
|
||||
}
|
||||
|
||||
loadMore();
|
||||
void loadMore();
|
||||
}, [loadMore]);
|
||||
|
||||
const hasMore = relay.hasMore();
|
||||
|
||||
@@ -25,7 +25,7 @@ const UserRoleChangeContainer: FunctionComponent<Props> = (props) => {
|
||||
if (role === props.user.role) {
|
||||
return;
|
||||
}
|
||||
updateUserRole({ userID: props.user.id, role });
|
||||
void updateUserRole({ userID: props.user.id, role });
|
||||
},
|
||||
[props.user.id, props.user.role, updateUserRole]
|
||||
);
|
||||
|
||||
@@ -48,7 +48,7 @@ const UserStatusChangeContainer: FunctionComponent<Props> = (props) => {
|
||||
if (!user.status.ban.active) {
|
||||
return;
|
||||
}
|
||||
removeUserBan({ userID: user.id });
|
||||
void removeUserBan({ userID: user.id });
|
||||
}, [user, removeUserBan]);
|
||||
const handleSuspend = useCallback(() => {
|
||||
if (user.status.suspension.active) {
|
||||
@@ -60,7 +60,7 @@ const UserStatusChangeContainer: FunctionComponent<Props> = (props) => {
|
||||
if (!user.status.suspension.active) {
|
||||
return;
|
||||
}
|
||||
removeUserSuspension({ userID: user.id });
|
||||
void removeUserSuspension({ userID: user.id });
|
||||
}, [user, removeUserSuspension]);
|
||||
|
||||
const handlePremod = useCallback(() => {
|
||||
@@ -71,7 +71,7 @@ const UserStatusChangeContainer: FunctionComponent<Props> = (props) => {
|
||||
}, [user, setShowPremod]);
|
||||
|
||||
const handlePremodConfirm = useCallback(() => {
|
||||
premodUser({ userID: user.id });
|
||||
void premodUser({ userID: user.id });
|
||||
setShowPremod(false);
|
||||
}, [premodUser, user, setShowPremod]);
|
||||
|
||||
@@ -83,7 +83,7 @@ const UserStatusChangeContainer: FunctionComponent<Props> = (props) => {
|
||||
if (!user.status.premod.active) {
|
||||
return;
|
||||
}
|
||||
removeUserPremod({ userID: user.id });
|
||||
void removeUserPremod({ userID: user.id });
|
||||
}, [user, premodUser]);
|
||||
|
||||
const handleSuspendModalClose = useCallback(() => {
|
||||
@@ -97,7 +97,7 @@ const UserStatusChangeContainer: FunctionComponent<Props> = (props) => {
|
||||
|
||||
const handleSuspendConfirm = useCallback(
|
||||
(timeout, message) => {
|
||||
suspendUser({
|
||||
void suspendUser({
|
||||
userID: user.id,
|
||||
timeout,
|
||||
message,
|
||||
@@ -109,7 +109,7 @@ const UserStatusChangeContainer: FunctionComponent<Props> = (props) => {
|
||||
|
||||
const handleBanConfirm = useCallback(
|
||||
(rejectExistingComments, message) => {
|
||||
banUser({ userID: user.id, message, rejectExistingComments });
|
||||
void banUser({ userID: user.id, message, rejectExistingComments });
|
||||
setShowBanned(false);
|
||||
},
|
||||
[user, setShowBanned]
|
||||
|
||||
@@ -32,4 +32,4 @@ async function main() {
|
||||
ReactDOM.render(<Index />, document.getElementById("app"));
|
||||
}
|
||||
|
||||
main();
|
||||
void main();
|
||||
|
||||
@@ -37,14 +37,14 @@ function createAuthCheckRoute(check: CheckParams) {
|
||||
private wasLoggedIn = false;
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.redirectIfNotLoggedIn();
|
||||
void this.redirectIfNotLoggedIn();
|
||||
}
|
||||
|
||||
public UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||
if (nextProps.data && nextProps.data.viewer) {
|
||||
this.wasLoggedIn = true;
|
||||
}
|
||||
this.redirectIfNotLoggedIn(nextProps, this.props);
|
||||
void this.redirectIfNotLoggedIn(nextProps, this.props);
|
||||
if (nextProps.data && !nextProps.data.viewer) {
|
||||
this.wasLoggedIn = false;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class RestrictedContainer extends Component<Props> {
|
||||
await this.props.signOut();
|
||||
// Wait for new context to propagate.
|
||||
await timeout();
|
||||
this.props.setRedirectPath({
|
||||
void this.props.setRedirectPath({
|
||||
path: location.pathname + location.search + location.hash,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
withFetch,
|
||||
withFragmentContainer,
|
||||
} from "coral-framework/lib/relay";
|
||||
import { OmitRefType } from "coral-framework/types";
|
||||
|
||||
import { OIDCConfig_formValues } from "coral-admin/__generated__/OIDCConfig_formValues.graphql";
|
||||
import { OIDCConfigContainer_auth as AuthData } from "coral-admin/__generated__/OIDCConfigContainer_auth.graphql";
|
||||
@@ -19,7 +20,9 @@ interface Props {
|
||||
auth: AuthData;
|
||||
disabled?: boolean;
|
||||
discoverOIDCConfiguration: FetchProp<typeof DiscoverOIDCConfigurationFetch>;
|
||||
form: FormApi<{ auth: AuthData & OIDCConfig_formValues }>;
|
||||
form: FormApi<{
|
||||
auth: OmitRefType<AuthData> & OmitRefType<OIDCConfig_formValues>;
|
||||
}>;
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
||||
+7
-7
@@ -87,30 +87,30 @@ const SSOSigningSecretCard: FunctionComponent<Props> = ({
|
||||
(rotation: string) => {
|
||||
switch (rotation) {
|
||||
case RotateOptions.NOW:
|
||||
rotateSSOSigningSecret({ inactiveIn: 0 });
|
||||
void rotateSSOSigningSecret({ inactiveIn: 0 });
|
||||
break;
|
||||
case RotateOptions.IN1DAY:
|
||||
rotateSSOSigningSecret({ inactiveIn: 24 * 60 * 60 });
|
||||
void rotateSSOSigningSecret({ inactiveIn: 24 * 60 * 60 });
|
||||
break;
|
||||
case RotateOptions.IN1WEEK:
|
||||
rotateSSOSigningSecret({ inactiveIn: 7 * 24 * 60 * 60 });
|
||||
void rotateSSOSigningSecret({ inactiveIn: 7 * 24 * 60 * 60 });
|
||||
break;
|
||||
case RotateOptions.IN30DAYS:
|
||||
rotateSSOSigningSecret({ inactiveIn: 30 * 24 * 60 * 60 });
|
||||
void rotateSSOSigningSecret({ inactiveIn: 30 * 24 * 60 * 60 });
|
||||
break;
|
||||
default:
|
||||
rotateSSOSigningSecret({ inactiveIn: 0 });
|
||||
void rotateSSOSigningSecret({ inactiveIn: 0 });
|
||||
}
|
||||
},
|
||||
[rotateSSOSigningSecret]
|
||||
);
|
||||
const onDeactivate = useCallback(() => {
|
||||
deactivateSSOSigningSecret({
|
||||
void deactivateSSOSigningSecret({
|
||||
kid: id,
|
||||
});
|
||||
}, [deactivateSSOSigningSecret, id]);
|
||||
const onDelete = useCallback(() => {
|
||||
deleteSSOSigningSecret({
|
||||
void deleteSSOSigningSecret({
|
||||
kid: id,
|
||||
});
|
||||
}, [deleteSSOSigningSecret, id]);
|
||||
|
||||
+2
-2
@@ -38,7 +38,7 @@ const AnnouncementConfigContainer: FunctionComponent<Props> = ({
|
||||
const onCreate = useCallback((values) => {
|
||||
try {
|
||||
setSubmitError(null);
|
||||
createAnnouncement(values);
|
||||
void createAnnouncement(values);
|
||||
setShowForm(false);
|
||||
} catch (error) {
|
||||
setSubmitError(error.message);
|
||||
@@ -47,7 +47,7 @@ const AnnouncementConfigContainer: FunctionComponent<Props> = ({
|
||||
const onDelete = useCallback(() => {
|
||||
try {
|
||||
setSubmitError(null);
|
||||
deleteAnnouncement();
|
||||
void deleteAnnouncement();
|
||||
} catch (error) {
|
||||
setSubmitError(error.message);
|
||||
setShowForm(false);
|
||||
|
||||
@@ -35,7 +35,7 @@ class GeneralConfigRoute extends React.Component<Props> {
|
||||
const enhanced = withRouteConfig<Props>({
|
||||
getQuery: () => {
|
||||
// Start prefetching markdown editor.
|
||||
loadMarkdownEditor();
|
||||
void loadMarkdownEditor();
|
||||
|
||||
// Fetch graphql data.
|
||||
return graphql`
|
||||
|
||||
@@ -108,7 +108,7 @@ const PerspectiveConfig: FunctionComponent<Props> = ({ disabled }) => {
|
||||
</Localized>
|
||||
<Localized
|
||||
id="configure-moderation-perspective-toxicityThresholdDescription"
|
||||
$default={TOXICITY_THRESHOLD_DEFAULT + "%"}
|
||||
$default={TOXICITY_THRESHOLD_DEFAULT.toString() + "%"}
|
||||
>
|
||||
<HelperText>
|
||||
This value can be set a percentage between 0 and 100. This number
|
||||
|
||||
@@ -70,7 +70,7 @@ function handleAccountCompletion(props: Props) {
|
||||
}
|
||||
} else {
|
||||
// all set, complete account.
|
||||
props
|
||||
void props
|
||||
.completeAccount({ accessToken: props.local.accessToken! })
|
||||
.then(() => {
|
||||
props.router.replace(props.local.redirectPath || "/admin");
|
||||
|
||||
@@ -31,7 +31,7 @@ const AddEmailAddress: FunctionComponent = () => {
|
||||
} catch (error) {
|
||||
if (error instanceof InvalidRequestError) {
|
||||
if (error.code === "DUPLICATE_EMAIL") {
|
||||
setDuplicateEmail({ duplicateEmail: input.email });
|
||||
void setDuplicateEmail({ duplicateEmail: input.email });
|
||||
setView({ view: "LINK_ACCOUNT" });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export const QueueRoute: FunctionComponent<Props> = (props) => {
|
||||
);
|
||||
const viewNew = useMutation(QueueViewNewMutation);
|
||||
const onViewNew = useCallback(() => {
|
||||
viewNew({
|
||||
void viewNew({
|
||||
queue: props.queueName,
|
||||
storyID: props.storyID || null,
|
||||
siteID: props.siteID || null,
|
||||
|
||||
@@ -23,13 +23,13 @@ const StoryActionsContainer: FunctionComponent<Props> = (props) => {
|
||||
const closeStory = useMutation(CloseStoryMutation);
|
||||
const openStory = useMutation(OpenStoryMutation);
|
||||
const onRescrape = useCallback(() => {
|
||||
rescrape({ id: props.story.id });
|
||||
void rescrape({ id: props.story.id });
|
||||
}, [props.story.id]);
|
||||
const onClose = useCallback(() => {
|
||||
closeStory({ id: props.story.id });
|
||||
void closeStory({ id: props.story.id });
|
||||
}, [props.story.id]);
|
||||
const onOpen = useCallback(() => {
|
||||
openStory({ id: props.story.id });
|
||||
void openStory({ id: props.story.id });
|
||||
}, [props.story.id]);
|
||||
const canChangeStatus = can(props.viewer, Ability.CHANGE_STORY_STATUS);
|
||||
return (
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import TestRenderer from "react-test-renderer";
|
||||
import { v1 as uuid } from "uuid";
|
||||
|
||||
import { pureMerge } from "coral-common/utils";
|
||||
@@ -427,7 +426,7 @@ it("suspend user", async () => {
|
||||
selector: "tr",
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(userRow).getByLabelText("Change user status").props.onClick();
|
||||
});
|
||||
|
||||
@@ -435,7 +434,7 @@ it("suspend user", async () => {
|
||||
"A dropdown to change the user status"
|
||||
);
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(popup).getByText("Suspend", { selector: "button" }).props.onClick();
|
||||
});
|
||||
|
||||
@@ -443,7 +442,7 @@ it("suspend user", async () => {
|
||||
exact: false,
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(modal).getByType("form").props.onSubmit();
|
||||
});
|
||||
within(userRow).getByText("Suspended");
|
||||
@@ -490,7 +489,7 @@ it("remove user suspension", async () => {
|
||||
selector: "tr",
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(userRow).getByLabelText("Change user status").props.onClick();
|
||||
});
|
||||
|
||||
@@ -498,7 +497,7 @@ it("remove user suspension", async () => {
|
||||
"A dropdown to change the user status"
|
||||
);
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(popup)
|
||||
.getByText("Remove suspension", { selector: "button" })
|
||||
.props.onClick();
|
||||
@@ -539,7 +538,7 @@ it("suspend user with custom timeout", async () => {
|
||||
selector: "tr",
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(userRow).getByLabelText("Change user status").props.onClick();
|
||||
});
|
||||
|
||||
@@ -547,7 +546,7 @@ it("suspend user with custom timeout", async () => {
|
||||
"A dropdown to change the user status"
|
||||
);
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(popup).getByText("Suspend", { selector: "button" }).props.onClick();
|
||||
});
|
||||
|
||||
@@ -557,11 +556,11 @@ it("suspend user with custom timeout", async () => {
|
||||
|
||||
const changedDuration = within(modal).getByID("duration-604800");
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
changedDuration.props.onChange(changedDuration.props.value.toString());
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(modal).getByType("form").props.onSubmit();
|
||||
});
|
||||
within(userRow).getByText("Suspended");
|
||||
@@ -599,7 +598,7 @@ it("suspend user with custom message", async () => {
|
||||
selector: "tr",
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(userRow).getByLabelText("Change user status").props.onClick();
|
||||
});
|
||||
|
||||
@@ -607,7 +606,7 @@ it("suspend user with custom message", async () => {
|
||||
"A dropdown to change the user status"
|
||||
);
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(popup).getByText("Suspend", { selector: "button" }).props.onClick();
|
||||
});
|
||||
|
||||
@@ -617,17 +616,17 @@ it("suspend user with custom message", async () => {
|
||||
|
||||
const toggleEdit = within(modal).getByID("suspendModal-editMessage");
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
toggleEdit.props.onChange(true);
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(modal)
|
||||
.getByID("suspendModal-message")
|
||||
.props.onChange("YOU WERE SUSPENDED FOR BEHAVING BADLY");
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(modal).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
@@ -665,7 +664,7 @@ it("ban user", async () => {
|
||||
selector: "tr",
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(userRow).getByLabelText("Change user status").props.onClick();
|
||||
});
|
||||
|
||||
@@ -673,7 +672,7 @@ it("ban user", async () => {
|
||||
"A dropdown to change the user status"
|
||||
);
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(popup).getByText("Ban", { selector: "button" }).props.onClick();
|
||||
});
|
||||
|
||||
@@ -684,7 +683,7 @@ it("ban user", async () => {
|
||||
}
|
||||
);
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(modal).getByType("form").props.onSubmit();
|
||||
});
|
||||
within(userRow).getByText("Banned");
|
||||
@@ -722,7 +721,7 @@ it("ban user with custom message", async () => {
|
||||
selector: "tr",
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(userRow).getByLabelText("Change user status").props.onClick();
|
||||
});
|
||||
|
||||
@@ -730,7 +729,7 @@ it("ban user with custom message", async () => {
|
||||
"A dropdown to change the user status"
|
||||
);
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(popup).getByText("Ban", { selector: "button" }).props.onClick();
|
||||
});
|
||||
|
||||
@@ -743,17 +742,17 @@ it("ban user with custom message", async () => {
|
||||
|
||||
const toggleMessage = within(modal).getByID("banModal-showMessage");
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
toggleMessage.props.onChange(true);
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(modal)
|
||||
.getByID("banModal-message")
|
||||
.props.onChange("YOU WERE BANNED FOR BREAKING THE RULES");
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(modal).getByType("form").props.onSubmit();
|
||||
});
|
||||
within(userRow).getByText("Banned");
|
||||
@@ -802,7 +801,7 @@ it("remove user ban", async () => {
|
||||
selector: "tr",
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(userRow).getByLabelText("Change user status").props.onClick();
|
||||
});
|
||||
|
||||
@@ -810,7 +809,7 @@ it("remove user ban", async () => {
|
||||
"A dropdown to change the user status"
|
||||
);
|
||||
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
within(popup)
|
||||
.getByText("Remove ban", { selector: "button" })
|
||||
.props.onClick();
|
||||
|
||||
@@ -204,14 +204,13 @@ it("prevents stream lock out", async () => {
|
||||
window.confirm = stubCancel;
|
||||
// Let's disable stream target in local auth.
|
||||
act(() => streamTarget.props.onChange(false));
|
||||
within(streamTarget).debug();
|
||||
|
||||
// Send form
|
||||
await act(async () => await form.props.onSubmit());
|
||||
|
||||
// Submit button should not be disabled because we canceled the submit.
|
||||
wait(() => expect(saveChanges.props.disabled).toBe(true));
|
||||
wait(() => {
|
||||
await wait(() => expect(saveChanges.props.disabled).toBe(false));
|
||||
await wait(() => {
|
||||
expect(stubCancel.calledOnce).toBe(true);
|
||||
});
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ function handleAccountCompletion(props: Props) {
|
||||
return false;
|
||||
}
|
||||
// all set, complete account.
|
||||
completeAccount({ accessToken: accessToken! });
|
||||
void completeAccount({ accessToken: accessToken! });
|
||||
|
||||
// account completed.
|
||||
return true;
|
||||
|
||||
@@ -30,4 +30,4 @@ async function main() {
|
||||
ReactDOM.render(<Index />, document.getElementById("app"));
|
||||
}
|
||||
|
||||
main();
|
||||
void main();
|
||||
|
||||
@@ -234,7 +234,7 @@ it("shows server error", async () => {
|
||||
expect(submitButton.props.disabled).toBe(true);
|
||||
|
||||
await act(async () => {
|
||||
wait(() => expect(submitButton.props.disabled).toBe(false));
|
||||
await wait(() => expect(submitButton.props.disabled).toBe(false));
|
||||
});
|
||||
|
||||
within(main).getByText("Server Error");
|
||||
|
||||
@@ -44,7 +44,7 @@ const SignInContainer: FunctionComponent<Props> = ({
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
// Clear the error when we unmount.
|
||||
clearError();
|
||||
void clearError();
|
||||
};
|
||||
}, [clearError, auth]);
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ function createManagedCoralContextProvider(
|
||||
// This is called every time a user session starts or ends.
|
||||
private clearSession = async (nextAccessToken?: string) => {
|
||||
// Clear session storage.
|
||||
this.state.context.sessionStorage.clear();
|
||||
void this.state.context.sessionStorage.clear();
|
||||
|
||||
// Pause subscriptions.
|
||||
subscriptionClient.pause();
|
||||
|
||||
@@ -93,7 +93,7 @@ export function useImmediateFetch<V extends {}, R>(
|
||||
}, 100 + 50 * Math.random());
|
||||
}
|
||||
|
||||
doTheFetch();
|
||||
void doTheFetch();
|
||||
}, Object.values(variables).concat(isUndefined(refetch) ? [] : [refetch]));
|
||||
|
||||
return [state, loading];
|
||||
|
||||
@@ -5,22 +5,22 @@ it("should set and unset values", async () => {
|
||||
const storage = createPromisifiedStorage(createInMemoryStorage());
|
||||
await expect(storage.setItem("test", "value")).resolves.toBeUndefined();
|
||||
await expect(storage.getItem("test")).resolves.toBe("value");
|
||||
storage.removeItem("test");
|
||||
await storage.removeItem("test");
|
||||
await expect(storage.getItem("test")).resolves.toBeNull();
|
||||
});
|
||||
|
||||
it("should return length", async () => {
|
||||
const storage = createPromisifiedStorage(createInMemoryStorage());
|
||||
storage.setItem("a", "value");
|
||||
storage.setItem("b", "value");
|
||||
storage.setItem("c", "value");
|
||||
await storage.setItem("a", "value");
|
||||
await storage.setItem("b", "value");
|
||||
await storage.setItem("c", "value");
|
||||
await expect(storage.length).resolves.toBe(3);
|
||||
});
|
||||
|
||||
it("should nth value", async () => {
|
||||
const storage = createPromisifiedStorage(createInMemoryStorage());
|
||||
storage.setItem("a", "a");
|
||||
storage.setItem("b", "b");
|
||||
storage.setItem("c", "c");
|
||||
await storage.setItem("a", "a");
|
||||
await storage.setItem("b", "b");
|
||||
await storage.setItem("c", "c");
|
||||
await expect(storage.key(2)).resolves.toBe("c");
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ class PymStub {
|
||||
}
|
||||
|
||||
describe("PymStorage", () => {
|
||||
it("should set item", () => {
|
||||
it("should set item", async () => {
|
||||
const pym = new PymStub("localStorage");
|
||||
const storage = createPymStorage(pym as any, "localStorage");
|
||||
const promise = storage.setItem("test", "value");
|
||||
@@ -28,10 +28,10 @@ describe("PymStorage", () => {
|
||||
expect(method).toBe("setItem");
|
||||
expect(parameters).toEqual({ key: "test", value: "value" });
|
||||
pym.listeners["pymStorage.localStorage.response"](JSON.stringify({ id }));
|
||||
expect(promise).resolves.toBeUndefined();
|
||||
await expect(promise).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
it("should remove item", () => {
|
||||
it("should remove item", async () => {
|
||||
const pym = new PymStub("localStorage");
|
||||
const storage = createPymStorage(pym as any, "localStorage");
|
||||
const promise = storage.removeItem("test");
|
||||
@@ -41,10 +41,10 @@ describe("PymStorage", () => {
|
||||
expect(method).toBe("removeItem");
|
||||
expect(parameters).toEqual({ key: "test" });
|
||||
pym.listeners["pymStorage.localStorage.response"](JSON.stringify({ id }));
|
||||
expect(promise).resolves.toBeUndefined();
|
||||
await expect(promise).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
it("should get item", () => {
|
||||
it("should get item", async () => {
|
||||
const pym = new PymStub("localStorage");
|
||||
const storage = createPymStorage(pym as any, "localStorage");
|
||||
const promise = storage.getItem("test");
|
||||
@@ -56,10 +56,10 @@ describe("PymStorage", () => {
|
||||
pym.listeners["pymStorage.localStorage.response"](
|
||||
JSON.stringify({ id, result: "value" })
|
||||
);
|
||||
expect(promise).resolves.toBe("value");
|
||||
await expect(promise).resolves.toBe("value");
|
||||
});
|
||||
|
||||
it("should get length", () => {
|
||||
it("should get length", async () => {
|
||||
const pym = new PymStub("localStorage");
|
||||
const storage = createPymStorage(pym as any, "localStorage");
|
||||
const promise = storage.length;
|
||||
@@ -71,10 +71,10 @@ describe("PymStorage", () => {
|
||||
pym.listeners["pymStorage.localStorage.response"](
|
||||
JSON.stringify({ id, result: 3 })
|
||||
);
|
||||
expect(promise).resolves.toBe(3);
|
||||
await expect(promise).resolves.toBe(3);
|
||||
});
|
||||
|
||||
it("should get key", () => {
|
||||
it("should get key", async () => {
|
||||
const pym = new PymStub("localStorage");
|
||||
const storage = createPymStorage(pym as any, "localStorage");
|
||||
const promise = storage.key(2);
|
||||
@@ -86,10 +86,10 @@ describe("PymStorage", () => {
|
||||
pym.listeners["pymStorage.localStorage.response"](
|
||||
JSON.stringify({ id, result: "myKey" })
|
||||
);
|
||||
expect(promise).resolves.toBe("myKey");
|
||||
await expect(promise).resolves.toBe("myKey");
|
||||
});
|
||||
|
||||
it("should clear", () => {
|
||||
it("should clear", async () => {
|
||||
const pym = new PymStub("localStorage");
|
||||
const storage = createPymStorage(pym as any, "localStorage");
|
||||
const promise = storage.clear();
|
||||
@@ -99,11 +99,11 @@ describe("PymStorage", () => {
|
||||
expect(method).toBe("clear");
|
||||
expect(parameters).toEqual({});
|
||||
pym.listeners["pymStorage.localStorage.response"](JSON.stringify({ id }));
|
||||
expect(promise).resolves.toBeUndefined();
|
||||
await expect(promise).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
describe("on error", () => {
|
||||
it("should reject set item", () => {
|
||||
it("should reject set item", async () => {
|
||||
const pym = new PymStub("localStorage");
|
||||
const storage = createPymStorage(pym as any, "localStorage");
|
||||
const promise = storage.setItem("test", "value");
|
||||
@@ -113,9 +113,9 @@ describe("PymStorage", () => {
|
||||
pym.listeners["pymStorage.localStorage.error"](
|
||||
JSON.stringify({ id, error: "error" })
|
||||
);
|
||||
expect(promise).rejects.toThrow(new Error("error"));
|
||||
await expect(promise).rejects.toThrow(new Error("error"));
|
||||
});
|
||||
it("should reject remove item", () => {
|
||||
it("should reject remove item", async () => {
|
||||
const pym = new PymStub("localStorage");
|
||||
const storage = createPymStorage(pym as any, "localStorage");
|
||||
const promise = storage.removeItem("test");
|
||||
@@ -125,9 +125,9 @@ describe("PymStorage", () => {
|
||||
pym.listeners["pymStorage.localStorage.error"](
|
||||
JSON.stringify({ id, error: "error" })
|
||||
);
|
||||
expect(promise).rejects.toThrow(new Error("error"));
|
||||
await expect(promise).rejects.toThrow(new Error("error"));
|
||||
});
|
||||
it("should reject get item", () => {
|
||||
it("should reject get item", async () => {
|
||||
const pym = new PymStub("localStorage");
|
||||
const storage = createPymStorage(pym as any, "localStorage");
|
||||
const promise = storage.getItem("test");
|
||||
@@ -137,7 +137,7 @@ describe("PymStorage", () => {
|
||||
pym.listeners["pymStorage.localStorage.error"](
|
||||
JSON.stringify({ id, error: "error" })
|
||||
);
|
||||
expect(promise).rejects.toThrow(new Error("error"));
|
||||
await expect(promise).rejects.toThrow(new Error("error"));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
import { PostMessageService } from "coral-framework/lib/postMessage";
|
||||
import { RestClient } from "coral-framework/lib/rest";
|
||||
import { createPromisifiedStorage } from "coral-framework/lib/storage";
|
||||
import { createUUIDGenerator } from "coral-framework/testHelpers";
|
||||
import { act, createUUIDGenerator } from "coral-framework/testHelpers";
|
||||
|
||||
import createFluentBundle from "./createFluentBundle";
|
||||
import createRelayEnvironment from "./createRelayEnvironment";
|
||||
@@ -35,8 +35,8 @@ export interface Resolvers<Q extends Resolver<any, any> = any, M = any> {
|
||||
}
|
||||
|
||||
export interface TestResolvers<T extends Resolvers = any> {
|
||||
Query?: { [P in keyof Required<T>["Query"]]: () => any };
|
||||
Mutation?: { [P in keyof Required<T>["Mutation"]]: () => any };
|
||||
Query?: { [P in keyof Required<T>["Query"]]?: () => any };
|
||||
Mutation?: { [P in keyof Required<T>["Mutation"]]?: () => any };
|
||||
}
|
||||
|
||||
function createNodeMock(element: React.ReactElement<any>) {
|
||||
@@ -111,7 +111,7 @@ export default function createTestRenderer<
|
||||
};
|
||||
|
||||
let testRenderer: ReactTestRenderer;
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer = TestRenderer.create(
|
||||
<CoralContextProvider value={context}>{element}</CoralContextProvider>,
|
||||
{ createNodeMock }
|
||||
|
||||
@@ -3,3 +3,4 @@ export { Overwrite, PropTypesOf } from "coral-ui/types";
|
||||
export { DeepPartial } from "coral-common/types";
|
||||
|
||||
export type RelayEnumLiteral<T> = keyof T | "%future added value";
|
||||
export type OmitRefType<T> = Omit<T, " $refType">;
|
||||
|
||||
@@ -33,7 +33,7 @@ const App: FunctionComponent = () => {
|
||||
}
|
||||
}
|
||||
|
||||
check();
|
||||
void check();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
||||
@@ -30,4 +30,4 @@ async function main() {
|
||||
ReactDOM.render(<Index />, document.getElementById("app"));
|
||||
}
|
||||
|
||||
main();
|
||||
void main();
|
||||
|
||||
@@ -16,12 +16,12 @@ beforeAll(() => {
|
||||
});
|
||||
});
|
||||
|
||||
it("Sets activeTab", () => {
|
||||
it("Sets activeTab", async () => {
|
||||
const tab = "COMMENTS";
|
||||
const eventEmitter = new EventEmitter2();
|
||||
const mock = sinon.mock(eventEmitter);
|
||||
mock.expects("emit").withArgs("setMainTab", { tab });
|
||||
commit(environment, { tab }, { eventEmitter });
|
||||
await commit(environment, { tab }, { eventEmitter });
|
||||
expect(source.get(LOCAL_ID)!.activeTab).toEqual(tab);
|
||||
mock.verify();
|
||||
});
|
||||
|
||||
@@ -28,7 +28,7 @@ interface Props {
|
||||
|
||||
export class TabBarContainer extends Component<Props> {
|
||||
private handleSetActiveTab = (tab: SetActiveTabInput["tab"]) => {
|
||||
this.props.setActiveTab({ tab });
|
||||
void this.props.setActiveTab({ tab });
|
||||
};
|
||||
|
||||
public render() {
|
||||
|
||||
@@ -16,7 +16,7 @@ export class OnPostMessageSetAccessToken extends Component<Props> {
|
||||
super(props);
|
||||
// Auth popup will use this to handle a successful login.
|
||||
props.postMessage.on("setAccessToken", (accessToken: string) => {
|
||||
props.setAccessToken({ accessToken });
|
||||
void props.setAccessToken({ accessToken });
|
||||
SignedInEvent.emit(props.eventEmitter);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ export class OnPymLogin extends Component<Props> {
|
||||
|
||||
// Sets comment id through pym.
|
||||
props.pym.onMessage("login", (accessToken) => {
|
||||
this.props.setAccessToken({ accessToken });
|
||||
void this.props.setAccessToken({ accessToken });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ export class OnPymLogout extends Component<Props> {
|
||||
|
||||
// Sets comment id through pym.
|
||||
props.pym.onMessage("logout", (accessToken) => {
|
||||
this.props.signOut();
|
||||
void this.props.signOut();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -20,14 +20,14 @@ beforeAll(() => {
|
||||
});
|
||||
});
|
||||
|
||||
it("sets state", () => {
|
||||
commit(environment, { open: true, focus: false });
|
||||
it("sets state", async () => {
|
||||
await commit(environment, { open: true, focus: false });
|
||||
expect(source.get(AUTH_POPUP_ID)!.open).toEqual(true);
|
||||
expect(source.get(AUTH_POPUP_ID)!.focus).toEqual(false);
|
||||
});
|
||||
|
||||
it("sets state", () => {
|
||||
commit(environment, {
|
||||
it("sets state", async () => {
|
||||
await commit(environment, {
|
||||
open: false,
|
||||
focus: true,
|
||||
href: "https://coralproject.net",
|
||||
@@ -37,16 +37,16 @@ it("sets state", () => {
|
||||
expect(source.get(AUTH_POPUP_ID)!.href).toEqual("https://coralproject.net");
|
||||
});
|
||||
|
||||
it("keep previous state", () => {
|
||||
commit(environment, { open: false, focus: true });
|
||||
commit(environment, {});
|
||||
it("keep previous state", async () => {
|
||||
await commit(environment, { open: false, focus: true });
|
||||
await commit(environment, {});
|
||||
expect(source.get(AUTH_POPUP_ID)!.open).toEqual(false);
|
||||
expect(source.get(AUTH_POPUP_ID)!.focus).toEqual(true);
|
||||
});
|
||||
|
||||
it("change only one", () => {
|
||||
commit(environment, { open: false, focus: true });
|
||||
commit(environment, { open: true });
|
||||
it("change only one", async () => {
|
||||
await commit(environment, { open: false, focus: true });
|
||||
await commit(environment, { open: true });
|
||||
expect(source.get(AUTH_POPUP_ID)!.open).toEqual(true);
|
||||
expect(source.get(AUTH_POPUP_ID)!.focus).toEqual(true);
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ const useHandleIncompleteAccount = () => {
|
||||
) {
|
||||
// eslint-disable-next-line
|
||||
console.log("Coral: User account is incomplete. Perform logout.")
|
||||
signOut();
|
||||
void signOut();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -35,4 +35,4 @@ async function main() {
|
||||
ReactDOM.render(<Index />, document.getElementById("app"));
|
||||
}
|
||||
|
||||
main();
|
||||
void main();
|
||||
|
||||
@@ -24,9 +24,9 @@ afterEach(() => {
|
||||
window.history.replaceState(previousState, document.title, previousLocation);
|
||||
});
|
||||
|
||||
it("Sets comment id", () => {
|
||||
it("Sets comment id", async () => {
|
||||
const id = "comment1-id";
|
||||
commit(environment, { id }, {} as any);
|
||||
await commit(environment, { id }, {} as any);
|
||||
expect(source.get(LOCAL_ID)!.commentID).toEqual(id);
|
||||
expect(parseQuery(location.search).commentID).toEqual(id);
|
||||
});
|
||||
@@ -38,7 +38,7 @@ it("Should call setCommentID in pym", async () => {
|
||||
sendMessage: sinon.mock().once().withArgs("setCommentID", id),
|
||||
},
|
||||
};
|
||||
commit(environment, { id }, context as any);
|
||||
await commit(environment, { id }, context as any);
|
||||
await timeout();
|
||||
expect(source.get(LOCAL_ID)!.commentID).toEqual(id);
|
||||
context.pym.sendMessage.verify();
|
||||
@@ -50,7 +50,7 @@ it("Should call setCommentID in pym with empty id", async () => {
|
||||
sendMessage: sinon.mock().once().withArgs("setCommentID", ""),
|
||||
},
|
||||
};
|
||||
commit(environment, { id: null }, context as any);
|
||||
await commit(environment, { id: null }, context as any);
|
||||
await timeout();
|
||||
expect(source.get(LOCAL_ID)!.commentID).toEqual(null);
|
||||
expect(parseQuery(location.search).commentID).toBeUndefined();
|
||||
|
||||
@@ -23,36 +23,36 @@ beforeEach(() => {
|
||||
});
|
||||
});
|
||||
|
||||
it("emits ShowAuthPopupEvent and LoginPromptEvent on SIGN_IN", () => {
|
||||
it("emits ShowAuthPopupEvent and LoginPromptEvent on SIGN_IN", async () => {
|
||||
const view = "SIGN_IN";
|
||||
const eventEmitter = new EventEmitter2();
|
||||
const mock = sinon.mock(eventEmitter);
|
||||
mock.expects("emit").withArgs("loginPrompt");
|
||||
mock.expects("emit").withArgs("showAuthPopup", { view });
|
||||
commit(environment, { view }, { eventEmitter });
|
||||
await commit(environment, { view }, { eventEmitter });
|
||||
mock.verify();
|
||||
});
|
||||
|
||||
it("emits only ShowAuthPopupEvent on other views", () => {
|
||||
it("emits only ShowAuthPopupEvent on other views", async () => {
|
||||
const view = "FORGOT_PASSWORD";
|
||||
const eventEmitter = new EventEmitter2();
|
||||
const mock = sinon.mock(eventEmitter);
|
||||
mock.expects("emit").withArgs("showAuthPopup", { view });
|
||||
commit(environment, { view }, { eventEmitter });
|
||||
await commit(environment, { view }, { eventEmitter });
|
||||
mock.verify();
|
||||
});
|
||||
|
||||
it("opens popup or focus if already open", () => {
|
||||
it("opens popup or focus if already open", async () => {
|
||||
const view = "SIGN_IN";
|
||||
const context = {
|
||||
eventEmitter: new EventEmitter2(),
|
||||
};
|
||||
commit(environment, { view }, context);
|
||||
await commit(environment, { view }, context);
|
||||
expect(source.get(AUTH_POPUP_ID)!.open).toEqual(true);
|
||||
expect(source.get(AUTH_POPUP_ID)!.focus).toEqual(false);
|
||||
expect(source.get(AUTH_POPUP_ID)!.view).toEqual("SIGN_IN");
|
||||
|
||||
commit(environment, { view }, context);
|
||||
await commit(environment, { view }, context);
|
||||
expect(source.get(AUTH_POPUP_ID)!.open).toEqual(true);
|
||||
expect(source.get(AUTH_POPUP_ID)!.focus).toEqual(true);
|
||||
});
|
||||
|
||||
@@ -144,7 +144,7 @@ export class CommentContainer extends Component<Props, State> {
|
||||
};
|
||||
});
|
||||
} else {
|
||||
this.props.showAuthPopup({ view: "SIGN_IN" });
|
||||
void this.props.showAuthPopup({ view: "SIGN_IN" });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -157,7 +157,7 @@ export class CommentContainer extends Component<Props, State> {
|
||||
showEditDialog: true,
|
||||
}));
|
||||
} else {
|
||||
this.props.showAuthPopup({ view: "SIGN_IN" });
|
||||
void this.props.showAuthPopup({ view: "SIGN_IN" });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -189,7 +189,7 @@ export class CommentContainer extends Component<Props, State> {
|
||||
from: "COMMENT_STREAM",
|
||||
});
|
||||
e.preventDefault();
|
||||
this.props.setCommentID({ id: this.props.comment.id });
|
||||
void this.props.setCommentID({ id: this.props.comment.id });
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
+6
-3
@@ -51,7 +51,10 @@ const ModerationActionsContainer: FunctionComponent<Props> = ({
|
||||
if (!comment.revision) {
|
||||
return;
|
||||
}
|
||||
approve({ commentID: comment.id, commentRevisionID: comment.revision.id });
|
||||
void approve({
|
||||
commentID: comment.id,
|
||||
commentRevisionID: comment.revision.id,
|
||||
});
|
||||
}, [approve, comment]);
|
||||
const onReject = useCallback(async () => {
|
||||
if (!comment.revision) {
|
||||
@@ -67,7 +70,7 @@ const ModerationActionsContainer: FunctionComponent<Props> = ({
|
||||
if (!comment.revision) {
|
||||
return;
|
||||
}
|
||||
feature({
|
||||
void feature({
|
||||
storyID: story.id,
|
||||
commentID: comment.id,
|
||||
commentRevisionID: comment.revision.id,
|
||||
@@ -75,7 +78,7 @@ const ModerationActionsContainer: FunctionComponent<Props> = ({
|
||||
onDismiss();
|
||||
}, [feature, onDismiss, story, comment]);
|
||||
const onUnfeature = useCallback(() => {
|
||||
unfeature({
|
||||
void unfeature({
|
||||
commentID: comment.id,
|
||||
storyID: story.id,
|
||||
});
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ async function commit(
|
||||
},
|
||||
actionCounts: {
|
||||
reaction: {
|
||||
total: currentCount + 1,
|
||||
total: (currentCount as number) + 1,
|
||||
},
|
||||
},
|
||||
} as any,
|
||||
|
||||
+8
-5
@@ -65,7 +65,7 @@ export class ReplyCommentFormContainer extends Component<Props, State> {
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.init();
|
||||
void this.init();
|
||||
}
|
||||
|
||||
private handleRTERef = (rte: CoralRTE | null) => {
|
||||
@@ -91,7 +91,7 @@ export class ReplyCommentFormContainer extends Component<Props, State> {
|
||||
}
|
||||
|
||||
private handleOnCancelOrDismiss = () => {
|
||||
this.props.sessionStorage.removeItem(this.contextKey);
|
||||
void this.props.sessionStorage.removeItem(this.contextKey);
|
||||
if (this.props.onClose) {
|
||||
this.props.onClose();
|
||||
}
|
||||
@@ -119,7 +119,7 @@ export class ReplyCommentFormContainer extends Component<Props, State> {
|
||||
})
|
||||
);
|
||||
if (submitStatus !== "RETRY") {
|
||||
this.props.sessionStorage.removeItem(this.contextKey);
|
||||
void this.props.sessionStorage.removeItem(this.contextKey);
|
||||
if (submitStatus === "APPROVED" && this.props.onClose) {
|
||||
this.props.onClose();
|
||||
return;
|
||||
@@ -150,9 +150,12 @@ export class ReplyCommentFormContainer extends Component<Props, State> {
|
||||
|
||||
private handleOnChange: ReplyCommentFormProps["onChange"] = (state, form) => {
|
||||
if (state.values.body) {
|
||||
this.props.sessionStorage.setItem(this.contextKey, state.values.body);
|
||||
void this.props.sessionStorage.setItem(
|
||||
this.contextKey,
|
||||
state.values.body
|
||||
);
|
||||
} else {
|
||||
this.props.sessionStorage.removeItem(this.contextKey);
|
||||
void this.props.sessionStorage.removeItem(this.contextKey);
|
||||
}
|
||||
// Reset errors whenever user clears the form.
|
||||
if (state.touched && state.touched.body && !state.values.body) {
|
||||
|
||||
@@ -50,7 +50,7 @@ const ReportButton: FunctionComponent<Props> = ({
|
||||
}, [comment]);
|
||||
|
||||
const signIn = useCallback(() => {
|
||||
showAuthPopup({ view: "SIGN_IN" });
|
||||
void showAuthPopup({ view: "SIGN_IN" });
|
||||
}, [showAuthPopup]);
|
||||
|
||||
if (isReported) {
|
||||
|
||||
@@ -44,7 +44,7 @@ const ShowConversationLink: FunctionComponent<ShowConversationLinkProps> = (
|
||||
target="_parent"
|
||||
anchor
|
||||
>
|
||||
Read More of this Conversation >
|
||||
Read More of this Conversation >
|
||||
</Button>
|
||||
</Localized>
|
||||
);
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ const UserBanPopoverContainer: FunctionComponent<Props> = ({
|
||||
const { localeBundles } = useCoralContext();
|
||||
|
||||
const onBan = useCallback(() => {
|
||||
banUser({
|
||||
void banUser({
|
||||
userID: user.id,
|
||||
commentID: comment.id,
|
||||
rejectExistingComments: false,
|
||||
@@ -47,7 +47,7 @@ const UserBanPopoverContainer: FunctionComponent<Props> = ({
|
||||
),
|
||||
});
|
||||
if (!rejected && comment.revision) {
|
||||
reject({
|
||||
void reject({
|
||||
commentID: comment.id,
|
||||
commentRevisionID: comment.revision.id,
|
||||
storyID: story.id,
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ export const UserIgnorePopoverContainer: FunctionComponent<Props> = ({
|
||||
}) => {
|
||||
const ignoreUser = useMutation(IgnoreUserMutation);
|
||||
const onIgnore = useCallback(() => {
|
||||
ignoreUser({ userID: user.id });
|
||||
void ignoreUser({ userID: user.id });
|
||||
onDismiss();
|
||||
}, [user.id, ignoreUser]);
|
||||
return (
|
||||
|
||||
@@ -36,7 +36,7 @@ class PermalinkViewContainer extends React.Component<
|
||||
ViewFullDiscussionEvent.emit(this.props.eventEmitter, {
|
||||
commentID: this.props.comment && this.props.comment.id,
|
||||
});
|
||||
this.props.setCommentID({ id: null });
|
||||
void this.props.setCommentID({ id: null });
|
||||
e.preventDefault();
|
||||
};
|
||||
private getShowAllCommentsHref() {
|
||||
|
||||
@@ -107,7 +107,7 @@ export const ReplyListContainer: React.FunctionComponent<Props> = (props) => {
|
||||
|
||||
const viewNew = useMutation(ReplyListViewNewMutation);
|
||||
const onViewNew = useCallback(() => {
|
||||
viewNew({ commentID: props.comment.id });
|
||||
void viewNew({ commentID: props.comment.id });
|
||||
}, [props.comment.id, viewNew]);
|
||||
|
||||
const viewNewCount =
|
||||
|
||||
@@ -32,7 +32,7 @@ export const AnnouncementContainer: FunctionComponent<Props> = ({
|
||||
}
|
||||
}
|
||||
}
|
||||
getDismissedStatus();
|
||||
void getDismissedStatus();
|
||||
}, [settings]);
|
||||
const dismissAnnouncement = useCallback(async () => {
|
||||
if (settings.announcement) {
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ const AnsweredCommentContainer: FunctionComponent<Props> = (props) => {
|
||||
from: "FEATURED_COMMENTS",
|
||||
commentID: comment.id,
|
||||
});
|
||||
setCommentID({ id: comment.id });
|
||||
void setCommentID({ id: comment.id });
|
||||
return false;
|
||||
},
|
||||
[setCommentID, comment]
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ const StreamDeletionRequestCalloutContainer: FunctionComponent<Props> = ({
|
||||
|
||||
const cancelAccountDeletion = useMutation(CancelAccountDeletionMutation);
|
||||
const cancelDeletion = useCallback(() => {
|
||||
cancelAccountDeletion();
|
||||
void cancelAccountDeletion();
|
||||
}, [cancelAccountDeletion]);
|
||||
|
||||
const deletionDate = viewer.scheduledDeletionDate
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ const FeaturedCommentContainer: FunctionComponent<Props> = (props) => {
|
||||
from: "FEATURED_COMMENTS",
|
||||
commentID: comment.id,
|
||||
});
|
||||
setCommentID({ id: comment.id });
|
||||
void setCommentID({ id: comment.id });
|
||||
return false;
|
||||
},
|
||||
[setCommentID, comment]
|
||||
|
||||
+3
-3
@@ -92,7 +92,7 @@ export class PostCommentFormContainer extends Component<Props, State> {
|
||||
// Restore comment draft, if available.
|
||||
this.state.notLoggedInDraft = preserveNotLoggedInDraft;
|
||||
preserveNotLoggedInDraft = "";
|
||||
this.init();
|
||||
void this.init();
|
||||
}
|
||||
|
||||
public componentWillUnmount() {
|
||||
@@ -168,9 +168,9 @@ export class PostCommentFormContainer extends Component<Props, State> {
|
||||
this.setState({ submitStatus: null });
|
||||
}
|
||||
if (state.values.body) {
|
||||
this.props.sessionStorage.setItem(contextKey, state.values.body);
|
||||
void this.props.sessionStorage.setItem(contextKey, state.values.body);
|
||||
} else {
|
||||
this.props.sessionStorage.removeItem(contextKey);
|
||||
void this.props.sessionStorage.removeItem(contextKey);
|
||||
}
|
||||
|
||||
// Reset errors whenever user clears the form.
|
||||
|
||||
+4
-1
@@ -49,7 +49,10 @@ class StoryClosedTimeoutContainer extends React.Component<Props> {
|
||||
|
||||
private handleClose = () => {
|
||||
this.timer = null;
|
||||
this.props.setStoryClosed({ storyID: this.props.story.id, isClosed: true });
|
||||
void this.props.setStoryClosed({
|
||||
storyID: this.props.story.id,
|
||||
isClosed: true,
|
||||
});
|
||||
};
|
||||
|
||||
public render() {
|
||||
|
||||
@@ -43,7 +43,7 @@ const AddMessageOpen: FunctionComponent<Props> = ({
|
||||
return;
|
||||
}
|
||||
|
||||
updateMutation({
|
||||
void updateMutation({
|
||||
id: storyID,
|
||||
settings: {
|
||||
messageBox: {
|
||||
@@ -58,7 +58,7 @@ const AddMessageOpen: FunctionComponent<Props> = ({
|
||||
[updateMutation, setShowSuccess]
|
||||
);
|
||||
const onRemoveClicked = useCallback(() => {
|
||||
updateMutation({
|
||||
void updateMutation({
|
||||
id: storyID,
|
||||
settings: {
|
||||
messageBox: { icon: "", content: "", enabled: false },
|
||||
|
||||
@@ -19,7 +19,7 @@ const loadConfigureContainer = () =>
|
||||
import("./ConfigureContainer" /* webpackChunkName: "configure" */).then(
|
||||
(x) => {
|
||||
// New css is loaded, take care of polyfilling those css vars for IE11.
|
||||
polyfillCSSVarsForIE11();
|
||||
void polyfillCSSVarsForIE11();
|
||||
return x;
|
||||
}
|
||||
);
|
||||
|
||||
+2
-2
@@ -36,9 +36,9 @@ const OpenOrCloseStreamContainer: FunctionComponent<Props> = ({
|
||||
if (!waiting) {
|
||||
setWaiting(true);
|
||||
if (story.isClosed) {
|
||||
openStory({ id: story.id });
|
||||
await openStory({ id: story.id });
|
||||
} else {
|
||||
closeStory({ id: story.id });
|
||||
await closeStory({ id: story.id });
|
||||
}
|
||||
setWaiting(false);
|
||||
setShowSuccess(true);
|
||||
|
||||
@@ -117,7 +117,7 @@ const ExpertSelectionContainer: FunctionComponent<Props> = ({
|
||||
|
||||
const onAddExpert = useCallback(
|
||||
(id: string) => {
|
||||
addExpertMutation({
|
||||
void addExpertMutation({
|
||||
storyID,
|
||||
userID: id,
|
||||
});
|
||||
@@ -127,7 +127,7 @@ const ExpertSelectionContainer: FunctionComponent<Props> = ({
|
||||
);
|
||||
const onRemoveExpert = useCallback(
|
||||
(id: string, username: string | null, email: string | null) => {
|
||||
removeExpertMutation({
|
||||
void removeExpertMutation({
|
||||
storyID,
|
||||
userID: id,
|
||||
});
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ const DeletionRequestCalloutContainer: FunctionComponent<Props> = ({
|
||||
|
||||
const cancelDeletionMutation = useMutation(CancelAccountDeletionMutation);
|
||||
const cancelDeletion = useCallback(() => {
|
||||
cancelDeletionMutation();
|
||||
void cancelDeletionMutation();
|
||||
}, [cancelDeletionMutation]);
|
||||
|
||||
const { locales } = useCoralContext();
|
||||
|
||||
@@ -28,7 +28,7 @@ const HistoryCommentContainer: FunctionComponent<Props> = (props) => {
|
||||
const handleGotoConversation = useCallback(
|
||||
(e: React.MouseEvent) => {
|
||||
if (props.story.id === props.comment.story.id) {
|
||||
props.setCommentID({ id: props.comment.id });
|
||||
void props.setCommentID({ id: props.comment.id });
|
||||
emitViewConversationEvent({
|
||||
from: "COMMENT_HISTORY",
|
||||
commentID: props.comment.id,
|
||||
|
||||
@@ -19,7 +19,7 @@ import { ProfileQueryLocal as Local } from "coral-stream/__generated__/ProfileQu
|
||||
const loadProfileContainer = () =>
|
||||
import("./ProfileContainer" /* webpackChunkName: "profile" */).then((x) => {
|
||||
// New css is loaded, take care of polyfilling those css vars for IE11.
|
||||
polyfillCSSVarsForIE11();
|
||||
void polyfillCSSVarsForIE11();
|
||||
return x;
|
||||
});
|
||||
// (cvle) For some reason without `setTimeout` this request will block other requests.
|
||||
|
||||
@@ -30,16 +30,16 @@ const ChangePasswordContainer: FunctionComponent<Props> = ({
|
||||
const setAuthPopupState = useMutation(SetAuthPopupStateMutation);
|
||||
const showAuthPopup = useMutation(ShowAuthPopupMutation);
|
||||
const onResetPassword = useCallback(() => {
|
||||
showAuthPopup({ view: "FORGOT_PASSWORD" });
|
||||
void showAuthPopup({ view: "FORGOT_PASSWORD" });
|
||||
}, [showAuthPopup]);
|
||||
const onFocus = useCallback(() => {
|
||||
setAuthPopupState({ focus: true });
|
||||
void setAuthPopupState({ focus: true });
|
||||
}, [setAuthPopupState]);
|
||||
const onBlur = useCallback(() => {
|
||||
setAuthPopupState({ focus: true });
|
||||
void setAuthPopupState({ focus: true });
|
||||
}, [setAuthPopupState]);
|
||||
const onClose = useCallback(() => {
|
||||
setAuthPopupState({ open: false });
|
||||
void setAuthPopupState({ open: false });
|
||||
}, [setAuthPopupState]);
|
||||
|
||||
if (
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ const DeleteAccountContainer: FunctionComponent<Props> = ({
|
||||
}, [setDeletePopoverVisible]);
|
||||
|
||||
const cancelDeletion = useCallback(() => {
|
||||
cancelAccountDeletion();
|
||||
void cancelAccountDeletion();
|
||||
}, [cancelAccountDeletion]);
|
||||
|
||||
const { locales } = useCoralContext();
|
||||
|
||||
@@ -67,7 +67,7 @@ it("validate min", async () => {
|
||||
act(() => rte.props.onChange("ab"));
|
||||
act(() => form.props.onSubmit());
|
||||
await act(async () => {
|
||||
waitForElement(() => within(form).getByText(text));
|
||||
await waitForElement(() => within(form).getByText(text));
|
||||
});
|
||||
|
||||
// Reset validation when erasing all content.
|
||||
@@ -153,10 +153,14 @@ it("update from server upon specific char count error", async () => {
|
||||
);
|
||||
|
||||
act(() => rte.props.onChange("abc"));
|
||||
waitForElement(() => within(form).getByText("7 characters remaining"));
|
||||
await waitForElement(() =>
|
||||
within(form).getByText("7 characters remaining")
|
||||
);
|
||||
|
||||
act(() => rte.props.onChange("abcdefgh"));
|
||||
waitForElement(() => within(form).getByText("2 characters remaining"));
|
||||
await waitForElement(() =>
|
||||
within(form).getByText("2 characters remaining")
|
||||
);
|
||||
|
||||
act(() => {
|
||||
form.props.onSubmit();
|
||||
|
||||
@@ -114,10 +114,10 @@ it("show remaining characters", async () => {
|
||||
const { rte, form } = await createTestRenderer();
|
||||
|
||||
act(() => rte.props.onChange("abc"));
|
||||
waitForElement(() => within(form).getByText("7 characters remaining"));
|
||||
await waitForElement(() => within(form).getByText("7 characters remaining"));
|
||||
|
||||
act(() => rte.props.onChange("abcdefghijkl"));
|
||||
waitForElement(() => within(form).getByText("-2 characters remaining"));
|
||||
await waitForElement(() => within(form).getByText("-2 characters remaining"));
|
||||
});
|
||||
|
||||
it("update from server upon specific char count error", async () => {
|
||||
@@ -157,16 +157,22 @@ it("update from server upon specific char count error", async () => {
|
||||
);
|
||||
|
||||
act(() => rte.props.onChange("abc"));
|
||||
waitForElement(() => within(form).getByText("7 characters remaining"));
|
||||
await waitForElement(() =>
|
||||
within(form).getByText("7 characters remaining")
|
||||
);
|
||||
|
||||
act(() => rte.props.onChange("abcdefgh"));
|
||||
waitForElement(() => within(form).getByText("2 characters remaining"));
|
||||
await waitForElement(() =>
|
||||
within(form).getByText("2 characters remaining")
|
||||
);
|
||||
|
||||
await act(async () => form.props.onSubmit());
|
||||
waitForElement(() => within(form).getByText("-3 characters remaining"));
|
||||
await waitForElement(() =>
|
||||
within(form).getByText("-3 characters remaining")
|
||||
);
|
||||
|
||||
// Body submit error should be displayed.
|
||||
waitForElement(() => within(form).getByText(errorCode));
|
||||
await waitForElement(() => within(form).getByText(errorCode));
|
||||
|
||||
act(() => rte.props.onChange("abcde"));
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ async function createTestRenderer(
|
||||
}
|
||||
|
||||
it("emit commentCount events", (done) => {
|
||||
createTestRenderer().then(({ context: { eventEmitter } }) => {
|
||||
void createTestRenderer().then(({ context: { eventEmitter } }) => {
|
||||
eventEmitter.on("commentCount", (args) => {
|
||||
expect(args).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
|
||||
@@ -5,7 +5,8 @@ jest.mock("react-transition-group", () => ({
|
||||
}));
|
||||
|
||||
jest.mock("react-dom", () => ({
|
||||
...jest.requireActual("react-dom"),
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
...(jest.requireActual("react-dom") as any),
|
||||
createPortal: (node: any) => node,
|
||||
}));
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ import React from "react";
|
||||
import TestRenderer, { ReactTestRenderer } from "react-test-renderer";
|
||||
import sinon from "sinon";
|
||||
|
||||
import { act } from "coral-framework/testHelpers";
|
||||
|
||||
import Modal from "./Modal";
|
||||
|
||||
const createNodeMock = () => ({
|
||||
@@ -12,7 +14,7 @@ const createNodeMock = () => ({
|
||||
it("renders correctly", () => {
|
||||
expect(document.body.lastChild).toBeNull();
|
||||
let testRenderer: ReactTestRenderer;
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer = TestRenderer.create(
|
||||
<Modal>
|
||||
<div>Test</div>
|
||||
@@ -22,7 +24,7 @@ it("renders correctly", () => {
|
||||
});
|
||||
expect(testRenderer!.toJSON()).toBeNull();
|
||||
expect(document.body.lastChild).toBeNull();
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer.update(
|
||||
<Modal open>
|
||||
<div>Test</div>
|
||||
@@ -33,7 +35,7 @@ it("renders correctly", () => {
|
||||
expect(document.body.lastElementChild!.getAttribute("data-portal")).toBe(
|
||||
"modal"
|
||||
);
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer.unmount();
|
||||
});
|
||||
expect(document.body.lastChild).toBeNull();
|
||||
@@ -45,7 +47,7 @@ it("relays backdrop click events", () => {
|
||||
const onClose = sinon.stub();
|
||||
expect(document.body.lastChild).toBeNull();
|
||||
let testRenderer: ReactTestRenderer;
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer = TestRenderer.create(
|
||||
<Modal open onBackdropClick={onBackdropClick} onClose={onClose}>
|
||||
<div>Test</div>
|
||||
@@ -56,7 +58,7 @@ it("relays backdrop click events", () => {
|
||||
testRenderer!.root
|
||||
.findByProps({ "data-testid": "backdrop" })
|
||||
.props.onClick(event);
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer.unmount();
|
||||
});
|
||||
expect(onBackdropClick.called).toBe(true);
|
||||
@@ -70,7 +72,7 @@ it("relays esc events", () => {
|
||||
const onClose = sinon.stub();
|
||||
expect(document.body.lastChild).toBeNull();
|
||||
let testRenderer: ReactTestRenderer;
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer = TestRenderer.create(
|
||||
<Modal open onEscapeKeyDown={onEscapeKeyDown} onClose={onClose}>
|
||||
<div>Test</div>
|
||||
@@ -81,7 +83,7 @@ it("relays esc events", () => {
|
||||
const el = testRenderer!.root.find((i) => i.props.onKeyDown);
|
||||
el.props.onKeyDown(escEvent);
|
||||
el.props.onKeyDown(otherEvent);
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer.unmount();
|
||||
});
|
||||
expect(onEscapeKeyDown.called).toBe(true);
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
import React from "react";
|
||||
import TestRenderer, { ReactTestRenderer } from "react-test-renderer";
|
||||
|
||||
import { act } from "coral-framework/testHelpers";
|
||||
|
||||
import NoScroll from "./NoScroll";
|
||||
|
||||
it("renders correctly", () => {
|
||||
expect(document.body.className).toBe("");
|
||||
let testRenderer: ReactTestRenderer;
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer = TestRenderer.create(<NoScroll active />);
|
||||
});
|
||||
expect(document.body.className).toBe("NoScroll-noScroll");
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer.update(<NoScroll />);
|
||||
});
|
||||
expect(document.body.className).toBe("");
|
||||
@@ -19,7 +21,7 @@ it("renders correctly", () => {
|
||||
it("renders correctly with multiple instances", () => {
|
||||
expect(document.body.className).toBe("");
|
||||
let testRenderer: ReactTestRenderer;
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer = TestRenderer.create(
|
||||
<>
|
||||
<NoScroll active />
|
||||
@@ -29,7 +31,7 @@ it("renders correctly with multiple instances", () => {
|
||||
);
|
||||
});
|
||||
expect(document.body.className).toBe("NoScroll-noScroll");
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer.update(
|
||||
<>
|
||||
<NoScroll />
|
||||
@@ -39,7 +41,7 @@ it("renders correctly with multiple instances", () => {
|
||||
);
|
||||
});
|
||||
expect(document.body.className).toBe("NoScroll-noScroll");
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer.update(
|
||||
<>
|
||||
<NoScroll />
|
||||
|
||||
@@ -3,6 +3,8 @@ import React from "react";
|
||||
import TestRenderer, { ReactTestRenderer } from "react-test-renderer";
|
||||
import sinon from "sinon";
|
||||
|
||||
import { act } from "coral-framework/testHelpers";
|
||||
|
||||
import Modal from "./Modal";
|
||||
|
||||
const createNodeMock = () => ({
|
||||
@@ -12,7 +14,7 @@ const createNodeMock = () => ({
|
||||
it("renders correctly", () => {
|
||||
expect(document.body.lastChild).toBeNull();
|
||||
let testRenderer: ReactTestRenderer;
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer = TestRenderer.create(
|
||||
<Modal>
|
||||
<div>Test</div>
|
||||
@@ -22,7 +24,7 @@ it("renders correctly", () => {
|
||||
});
|
||||
expect(testRenderer!.toJSON()).toBeNull();
|
||||
expect(document.body.lastChild).toBeNull();
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer.update(
|
||||
<Modal open>
|
||||
<div>Test</div>
|
||||
@@ -33,7 +35,7 @@ it("renders correctly", () => {
|
||||
expect(document.body.lastElementChild!.getAttribute("data-portal")).toBe(
|
||||
"modal"
|
||||
);
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer.unmount();
|
||||
});
|
||||
expect(document.body.lastChild).toBeNull();
|
||||
@@ -45,7 +47,7 @@ it("relays backdrop click events", () => {
|
||||
const onClose = sinon.stub();
|
||||
expect(document.body.lastChild).toBeNull();
|
||||
let testRenderer: ReactTestRenderer;
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer = TestRenderer.create(
|
||||
<Modal open onBackdropClick={onBackdropClick} onClose={onClose}>
|
||||
<div>Test</div>
|
||||
@@ -56,7 +58,7 @@ it("relays backdrop click events", () => {
|
||||
testRenderer!.root
|
||||
.findByProps({ "data-testid": "backdrop" })
|
||||
.props.onClick(event);
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer.unmount();
|
||||
});
|
||||
expect(onBackdropClick.called).toBe(true);
|
||||
@@ -70,7 +72,7 @@ it("relays esc events", () => {
|
||||
const onClose = sinon.stub();
|
||||
expect(document.body.lastChild).toBeNull();
|
||||
let testRenderer: ReactTestRenderer;
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer = TestRenderer.create(
|
||||
<Modal open onEscapeKeyDown={onEscapeKeyDown} onClose={onClose}>
|
||||
<div>Test</div>
|
||||
@@ -81,7 +83,7 @@ it("relays esc events", () => {
|
||||
const el = testRenderer!.root.find((i) => i.props.onKeyDown);
|
||||
el.props.onKeyDown(escEvent);
|
||||
el.props.onKeyDown(otherEvent);
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer.unmount();
|
||||
});
|
||||
expect(onEscapeKeyDown.called).toBe(true);
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
import React from "react";
|
||||
import TestRenderer, { ReactTestRenderer } from "react-test-renderer";
|
||||
|
||||
import { act } from "coral-framework/testHelpers";
|
||||
|
||||
import NoScroll from "./NoScroll";
|
||||
|
||||
it("renders correctly", () => {
|
||||
expect(document.body.className).toBe("");
|
||||
let testRenderer: ReactTestRenderer;
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer = TestRenderer.create(<NoScroll active />);
|
||||
});
|
||||
expect(document.body.className).toBe("NoScroll-noScroll");
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer.update(<NoScroll />);
|
||||
});
|
||||
expect(document.body.className).toBe("");
|
||||
@@ -19,7 +21,7 @@ it("renders correctly", () => {
|
||||
it("renders correctly with multiple instances", () => {
|
||||
expect(document.body.className).toBe("");
|
||||
let testRenderer: ReactTestRenderer;
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer = TestRenderer.create(
|
||||
<>
|
||||
<NoScroll active />
|
||||
@@ -29,7 +31,7 @@ it("renders correctly with multiple instances", () => {
|
||||
);
|
||||
});
|
||||
expect(document.body.className).toBe("NoScroll-noScroll");
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer.update(
|
||||
<>
|
||||
<NoScroll />
|
||||
@@ -39,7 +41,7 @@ it("renders correctly with multiple instances", () => {
|
||||
);
|
||||
});
|
||||
expect(document.body.className).toBe("NoScroll-noScroll");
|
||||
TestRenderer.act(() => {
|
||||
act(() => {
|
||||
testRenderer.update(
|
||||
<>
|
||||
<NoScroll />
|
||||
|
||||
@@ -20,6 +20,7 @@ export type Promiseable<T> = Promise<T> | T;
|
||||
|
||||
export type Nullable<T> = { [P in keyof T]: T[P] | null };
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export type DeepWritableObject<T> = T extends object
|
||||
? {
|
||||
-readonly [P in keyof T]: T[P] extends Array<infer U> | undefined
|
||||
@@ -34,6 +35,7 @@ export type DeepWritable<T> = T extends Array<infer U> | ReadonlyArray<infer U>
|
||||
? Array<DeepWritableObject<U>>
|
||||
: DeepWritableObject<T>;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export type DeepNullable<T> = T extends object
|
||||
? {
|
||||
[P in keyof T]: T[P] extends Array<infer U> | undefined
|
||||
@@ -47,6 +49,7 @@ export type DeepNullable<T> = T extends object
|
||||
/**
|
||||
* Like Partial, but recurses down the object marking each field as Partial.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export type DeepPartial<T> = T extends object
|
||||
? {
|
||||
[P in keyof T]?: T[P] extends Array<infer U> | undefined
|
||||
@@ -61,6 +64,7 @@ export type DeepPartial<T> = T extends object
|
||||
* FirstDeepPartial is like DeepPartial but applies only to the first parameters
|
||||
* on the object.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export type FirstDeepPartial<T> = T extends object
|
||||
? {
|
||||
[P in keyof T]: DeepPartial<T[P]>;
|
||||
|
||||
@@ -23,9 +23,9 @@ import { Request, RequestHandler } from "coral-server/types/express";
|
||||
|
||||
function getMetricsOptions(req: Request) {
|
||||
// Get the current Tenant on the request.
|
||||
const { id: tenantID } = req.coral?.tenant!;
|
||||
const { id: tenantID } = req.coral!.tenant!;
|
||||
|
||||
const now = req.coral?.now!;
|
||||
const now = req.coral!.now;
|
||||
|
||||
// To set a fixed date for the date, uncomment the line below.
|
||||
// const now = DateTime.utc(2020, 5, 5, 12, 30).toJSDate();
|
||||
|
||||
@@ -27,6 +27,7 @@ export type JWTStrategyOptions = Pick<
|
||||
/**
|
||||
* Token is the various forms of the Token that can be verified.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export type Token = OIDCIDToken | SSOToken | JWTToken | object | string | null;
|
||||
|
||||
/**
|
||||
@@ -49,6 +50,7 @@ export interface Verifier<T = Token> {
|
||||
* supports will perform type checking and ensure that the given Tenant
|
||||
* supports the requested verification type.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
supports: (token: T | object, tenant: Tenant, kid?: string) => token is T;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ export interface StrategyItem {
|
||||
jwksClient?: JwksClient;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export function isOIDCToken(token: OIDCIDToken | object): token is OIDCIDToken {
|
||||
const { error } = OIDCIDTokenSchema.validate(token, {
|
||||
// OIDC ID tokens may contain many other fields we haven't seen.. We Just
|
||||
|
||||
@@ -27,6 +27,7 @@ it("validates a jwt token", async () => {
|
||||
const tokenString = await signTokenString(config, user, tenant, {}, now);
|
||||
|
||||
// Verify that the token conforms to the JWT token schema.
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
const token = jwt.decode(tokenString) as object;
|
||||
|
||||
expect(isJWTToken(token)).toBeTruthy();
|
||||
|
||||
@@ -35,6 +35,7 @@ export const JWTTokenSchema = Joi.object().keys({
|
||||
pat: Joi.boolean(),
|
||||
});
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export function isJWTToken(token: JWTToken | object): token is JWTToken {
|
||||
const { error } = JWTTokenSchema.validate(token, {
|
||||
allowUnknown: true,
|
||||
@@ -59,6 +60,7 @@ export class JWTVerifier implements Verifier<JWTToken> {
|
||||
this.redis = redis;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
public supports(token: JWTToken | object, tenant: Tenant): token is JWTToken {
|
||||
return isJWTToken(token) && token.iss === tenant.id;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ export interface SSOToken {
|
||||
user: SSOUserProfile;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export function isSSOToken(token: SSOToken | object): token is SSOToken {
|
||||
const { error } = SSOTokenSchema.validate(token, { allowUnknown: true });
|
||||
return isNil(error);
|
||||
@@ -237,6 +238,7 @@ export class SSOVerifier implements Verifier<SSOToken> {
|
||||
}
|
||||
|
||||
public supports(
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
token: SSOToken | object,
|
||||
tenant: Tenant,
|
||||
kid?: string
|
||||
@@ -304,7 +306,7 @@ export class SSOVerifier implements Verifier<SSOToken> {
|
||||
// succeeded! Mark the key as used last now and break out. We should do
|
||||
// this in the nextTick because it's not important to have it recorded at
|
||||
// the same time.
|
||||
updateLastUsedAtKID(this.redis, tenant.id, key.kid, now);
|
||||
void updateLastUsedAtKID(this.redis, tenant.id, key.kid, now);
|
||||
|
||||
// TODO: [CORL-754] (wyattjoh) reintroduce when we amend the front-end to display the kid
|
||||
// if (!kid) {
|
||||
|
||||
@@ -65,7 +65,7 @@ export class Limiter {
|
||||
// if this is new or has no expiry
|
||||
if (tries === 1 || expiry === -1) {
|
||||
// then expire it after the timeout
|
||||
this.redis.expire(key, this.ttl);
|
||||
void this.redis.expire(key, this.ttl);
|
||||
}
|
||||
|
||||
if (tries > this.max) {
|
||||
|
||||
@@ -108,7 +108,7 @@ const processNotificationDigesting = (
|
||||
// TODO: sort the digest template elements by the digest order.
|
||||
|
||||
// Add the email containing the digest information.
|
||||
mailerQueue.add({
|
||||
void mailerQueue.add({
|
||||
tenantID: tenant.id,
|
||||
message: {
|
||||
to: user.email!,
|
||||
|
||||
@@ -184,7 +184,7 @@ export const Comments = (ctx: GraphContext) => ({
|
||||
)
|
||||
.then((comment) => {
|
||||
// Publish that the comment was featured.
|
||||
publishCommentFeatured(ctx.broker, comment);
|
||||
void publishCommentFeatured(ctx.broker, comment);
|
||||
|
||||
// Return it to the next step.
|
||||
return comment;
|
||||
|
||||
@@ -82,7 +82,7 @@ export const Comment: GQLCommentTypeResolver<comment.Comment> = {
|
||||
|
||||
const children = await ctx.loaders.Comments.visible.loadMany(childIDs);
|
||||
return children.reduce(
|
||||
(sum: any, c: any) => (c && hasPublishedStatus(c) ? sum + 1 : sum),
|
||||
(sum: number, c: any) => (c && hasPublishedStatus(c) ? sum + 1 : sum),
|
||||
0
|
||||
);
|
||||
},
|
||||
|
||||
@@ -19,7 +19,7 @@ export const ModerationQueue: GQLModerationQueueTypeResolver<ModerationQueueInpu
|
||||
id: ({ selector, connection: { filter } }) => {
|
||||
// NOTE: (wyattjoh) when the queues change shape in the future, investigate adding more dynamicness to this id generation
|
||||
if (filter && filter.storyID) {
|
||||
return selector + "::storyID:" + filter.storyID;
|
||||
return selector + "::storyID:" + (filter.storyID as string);
|
||||
}
|
||||
|
||||
return selector;
|
||||
|
||||
@@ -16,6 +16,6 @@ export function getRequestedFields<T>(info: GraphQLResolveInfo) {
|
||||
}
|
||||
|
||||
export function reconstructTenantURLResolver<T = any>(path: string) {
|
||||
return (parent: T, args: {}, ctx: GraphContext) =>
|
||||
return (parent: T, args: unknown, ctx: GraphContext) =>
|
||||
reconstructTenantURL(ctx.config, ctx.tenant, ctx.req, path);
|
||||
}
|
||||
|
||||
@@ -210,7 +210,10 @@ export async function updateSharedCommentCounts(
|
||||
const args = flattenDeep(Object.entries(moderationQueueQueues));
|
||||
|
||||
// Add the command to the pipeline.
|
||||
pipeline.mhincrby(commentCountsModerationQueueQueuesKey(tenantID), ...args);
|
||||
void pipeline.mhincrby(
|
||||
commentCountsModerationQueueQueuesKey(tenantID),
|
||||
...args
|
||||
);
|
||||
}
|
||||
|
||||
// Execute the pipeline.
|
||||
|
||||
@@ -80,7 +80,7 @@ export default class Task<T extends TenantResource, U = any> {
|
||||
* job requests.
|
||||
*/
|
||||
public process() {
|
||||
this.queue.process(async (job: Job<T>) => {
|
||||
void this.queue.process(async (job: Job<T>) => {
|
||||
const log = this.log.child(
|
||||
{ jobID: job.id, attemptsMade: job.attemptsMade },
|
||||
true
|
||||
|
||||
@@ -133,7 +133,8 @@ function createMessageTranslator(i18n: I18n) {
|
||||
}
|
||||
|
||||
// Translate the bundle.
|
||||
await loc.translateFragment(dom.window.document);
|
||||
// TODO: don't cast to any.
|
||||
await loc.translateFragment(dom.window.document as any);
|
||||
|
||||
// Grab the rendered HTML from the dom, and juice them.
|
||||
if (!dom.window.document.documentElement) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user