mirror of
https://github.com/wassname/talk.git
synced 2026-09-12 13:01:11 +08:00
[CORL-129] Render Community Guidelines (#2191)
* chore: Rename InnerProps to Props * feat: Render community guidelines * chore: refactor schema communityGuidelines* settings into it's own type * test: update snapshots
This commit is contained in:
+2
-2
@@ -33,7 +33,7 @@ const GuidelinesConfig: StatelessComponent<Props> = ({ disabled }) => (
|
||||
Show Community Guidelines Summary
|
||||
</InputLabel>
|
||||
</Localized>
|
||||
<OnOffField name="communityGuidelinesEnable" disabled={disabled} />
|
||||
<OnOffField name="communityGuidelines.enabled" disabled={disabled} />
|
||||
</FormField>
|
||||
|
||||
<FormField>
|
||||
@@ -56,7 +56,7 @@ const GuidelinesConfig: StatelessComponent<Props> = ({ disabled }) => (
|
||||
</Localized>
|
||||
</FormField>
|
||||
|
||||
<Field name="communityGuidelines">
|
||||
<Field name="communityGuidelines.content">
|
||||
{({ input, meta }) => (
|
||||
<>
|
||||
<Suspense fallback={<Spinner />}>
|
||||
|
||||
+4
-2
@@ -27,8 +27,10 @@ class GuidelinesConfigContainer extends React.Component<Props> {
|
||||
const enhanced = withFragmentContainer<Props>({
|
||||
settings: graphql`
|
||||
fragment GuidelinesConfigContainer_settings on Settings {
|
||||
communityGuidelinesEnable
|
||||
communityGuidelines
|
||||
communityGuidelines {
|
||||
enabled
|
||||
content
|
||||
}
|
||||
}
|
||||
`,
|
||||
})(GuidelinesConfigContainer);
|
||||
|
||||
@@ -131,8 +131,8 @@ exports[`renders configure general 1`] = `
|
||||
checked={false}
|
||||
className="RadioButton-input"
|
||||
disabled={false}
|
||||
id="communityGuidelinesEnable-true"
|
||||
name="communityGuidelinesEnable"
|
||||
id="communityGuidelines.enabled-true"
|
||||
name="communityGuidelines.enabled"
|
||||
onBlur={[Function]}
|
||||
onChange={[Function]}
|
||||
onFocus={[Function]}
|
||||
@@ -141,7 +141,7 @@ exports[`renders configure general 1`] = `
|
||||
/>
|
||||
<label
|
||||
className="RadioButton-label"
|
||||
htmlFor="communityGuidelinesEnable-true"
|
||||
htmlFor="communityGuidelines.enabled-true"
|
||||
>
|
||||
On
|
||||
</label>
|
||||
@@ -153,8 +153,8 @@ exports[`renders configure general 1`] = `
|
||||
checked={true}
|
||||
className="RadioButton-input"
|
||||
disabled={false}
|
||||
id="communityGuidelinesEnable-fase"
|
||||
name="communityGuidelinesEnable"
|
||||
id="communityGuidelines.enabled-fase"
|
||||
name="communityGuidelines.enabled"
|
||||
onBlur={[Function]}
|
||||
onChange={[Function]}
|
||||
onFocus={[Function]}
|
||||
@@ -163,7 +163,7 @@ exports[`renders configure general 1`] = `
|
||||
/>
|
||||
<label
|
||||
className="RadioButton-label"
|
||||
htmlFor="communityGuidelinesEnable-fase"
|
||||
htmlFor="communityGuidelines.enabled-fase"
|
||||
>
|
||||
Off
|
||||
</label>
|
||||
@@ -201,7 +201,7 @@ Markdown can be found
|
||||
>
|
||||
<textarea
|
||||
id="configure-general-guidelines-content"
|
||||
name="communityGuidelines"
|
||||
name="communityGuidelines.content"
|
||||
onChange={[Function]}
|
||||
value=""
|
||||
/>
|
||||
|
||||
@@ -72,10 +72,10 @@ it("change community guidlines", async () => {
|
||||
let settingsRecord = cloneDeep(settings);
|
||||
const updateSettingsStub = createSinonStub(s =>
|
||||
s.onFirstCall().callsFake((_: any, data: any) => {
|
||||
expect(data.input.settings.communityGuidelines).toEqual(
|
||||
expect(data.input.settings.communityGuidelines.content).toEqual(
|
||||
"This is the community guidlines summary"
|
||||
);
|
||||
expect(data.input.settings.communityGuidelinesEnable).toEqual(true);
|
||||
expect(data.input.settings.communityGuidelines.enabled).toEqual(true);
|
||||
settingsRecord = merge(settingsRecord, data.input.settings);
|
||||
return {
|
||||
settings: settingsRecord,
|
||||
|
||||
@@ -17,8 +17,10 @@ export const settings = {
|
||||
customCssUrl: null,
|
||||
domains: ["localhost:8080"],
|
||||
editCommentWindowLength: 30000,
|
||||
communityGuidelinesEnable: false,
|
||||
communityGuidelines: "",
|
||||
communityGuidelines: {
|
||||
enabled: false,
|
||||
content: "",
|
||||
},
|
||||
organizationContactEmail: "coral@test.com",
|
||||
organizationName: "Coral",
|
||||
integrations: {
|
||||
|
||||
Reference in New Issue
Block a user