-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make premoderate email address "too many periods" an Admin > Config
- Loading branch information
Showing
7 changed files
with
125 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/core/client/admin/routes/Configure/sections/Moderation/PremoderateEmailAddressConfig.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { Localized } from "@fluent/react/compat"; | ||
import React, { FunctionComponent } from "react"; | ||
import { graphql } from "react-relay"; | ||
|
||
import { | ||
FieldSet, | ||
FormField, | ||
FormFieldHeader, | ||
Label, | ||
} from "coral-ui/components/v2"; | ||
|
||
import ConfigBox from "../../ConfigBox"; | ||
import Header from "../../Header"; | ||
import HelperText from "../../HelperText"; | ||
import OnOffField from "../../OnOffField"; | ||
|
||
// eslint-disable-next-line no-unused-expressions | ||
graphql` | ||
fragment PremoderateEmailAddressConfig_formValues on Settings { | ||
premoderateEmailAddress { | ||
tooManyPeriods { | ||
enabled | ||
} | ||
} | ||
} | ||
`; | ||
|
||
interface Props { | ||
disabled: boolean; | ||
} | ||
|
||
const PremoderateEmailAddressConfig: FunctionComponent<Props> = ({ | ||
disabled, | ||
}) => { | ||
return ( | ||
<ConfigBox | ||
title={ | ||
<Localized id="configure-moderation-premoderateEmailAddress-title"> | ||
<Header container={<legend />}>Email address</Header> | ||
</Localized> | ||
} | ||
container={<FieldSet />} | ||
> | ||
<FormField container={<FieldSet />}> | ||
<FormFieldHeader> | ||
<Localized id="configure-moderation-premoderateEmailAddress-enabled"> | ||
<Label component="legend"> | ||
Premoderate users with too many periods | ||
</Label> | ||
</Localized> | ||
<Localized id="configure-moderation-premoderateEmailAddress-enabled"> | ||
<HelperText> | ||
If a users has three or more periods in the first part of their | ||
email address (before the @), set their status to pre-moderate all | ||
comments. This is often used because emails with more than 3 | ||
periods can have a very high spam correlation. | ||
</HelperText> | ||
</Localized> | ||
</FormFieldHeader> | ||
<OnOffField | ||
name="premoderateEmailAddress.tooManyPeriods.enabled" | ||
disabled={disabled} | ||
/> | ||
</FormField> | ||
</ConfigBox> | ||
); | ||
}; | ||
|
||
export default PremoderateEmailAddressConfig; |
12 changes: 12 additions & 0 deletions
12
src/core/server/graph/resolvers/PremoderateEmailAddress.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { | ||
GQLPremoderateEmailAddressConfig, | ||
GQLPremoderateEmailAddressConfigTypeResolver, | ||
} from "coral-server/graph/schema/__generated__/types"; | ||
|
||
export const SlackConfiguration: GQLPremoderateEmailAddressConfigTypeResolver<GQLPremoderateEmailAddressConfig> = | ||
{ | ||
tooManyPeriods: (config) => | ||
config && config.tooManyPeriods | ||
? config.tooManyPeriods | ||
: { enabled: false }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters