mirror of
https://github.com/wassname/talk.git
synced 2026-07-17 11:33:39 +08:00
* feat: moderation config * feat: configure banned and suspect words * chore: upgrade react and test libs to the newest version <3 * chore: upgrade typescript + some refactor * feat: general, organization and advanced configuration panes * fix: translation * feat: speedup fetching markdown editor * feat: localize markdown editor * chore: refactor container names * chore: rename infobox to communityGuidelines * feat: closing comment streams duration config * test: add feature tests for configurations * fix: mock only console.error * chore: upgrade node * chore: require node >= 10 * fix: better validation and default values * feat: Make DurationField a general purpose component and reuse for Edit Comment Timeframe * test: add unit test for duration field * fix: patch for bug when built in production * chore: bump npm version to latest * fix: adapted Dockerfile to new version of node * refactor: harmonized seconds/milliseconds to seconds * fix: resolve bug from merge conflict
57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
import { graphql } from "react-relay";
|
|
import { Environment } from "relay-runtime";
|
|
|
|
import {
|
|
commitMutationPromiseNormalized,
|
|
createMutationContainer,
|
|
} from "talk-framework/lib/relay";
|
|
import { Omit } from "talk-framework/types";
|
|
|
|
import { UpdateSettingsMutation as MutationTypes } from "talk-admin/__generated__/UpdateSettingsMutation.graphql";
|
|
|
|
export type UpdateSettingsInput = Omit<
|
|
MutationTypes["variables"]["input"],
|
|
"clientMutationId"
|
|
>;
|
|
|
|
const mutation = graphql`
|
|
mutation UpdateSettingsMutation($input: UpdateSettingsInput!) {
|
|
updateSettings(input: $input) {
|
|
settings {
|
|
auth {
|
|
...AuthConfigContainer_auth
|
|
}
|
|
...ModerationConfigContainer_settings
|
|
...GeneralConfigContainer_settings
|
|
...OrganizationConfigContainer_settings
|
|
...WordListConfigContainer_settings
|
|
...AdvancedConfigContainer_settings
|
|
}
|
|
clientMutationId
|
|
}
|
|
}
|
|
`;
|
|
|
|
let clientMutationId = 0;
|
|
|
|
function commit(environment: Environment, input: UpdateSettingsInput) {
|
|
return commitMutationPromiseNormalized<MutationTypes>(environment, {
|
|
mutation,
|
|
variables: {
|
|
input: {
|
|
...input,
|
|
clientMutationId: (clientMutationId++).toString(),
|
|
},
|
|
},
|
|
});
|
|
}
|
|
|
|
export const withUpdateSettingsMutation = createMutationContainer(
|
|
"updateSettings",
|
|
commit
|
|
);
|
|
|
|
export type UpdateSettingsMutation = (
|
|
input: UpdateSettingsInput
|
|
) => Promise<MutationTypes["response"]["updateSettings"]>;
|