fix: rename wordlist to wordList

This commit is contained in:
Wyatt Johnson
2018-10-22 15:52:17 -06:00
parent fa72d5deda
commit 3b6f3c9ea8
8 changed files with 22 additions and 26 deletions
@@ -209,9 +209,6 @@ export default class OIDCStrategy extends Strategy {
this.mongo = mongo;
this.cache = new TenantCacheAdapter(tenantCache);
// Connect the cache adapter.
this.cache.subscribe();
}
private lookupJWKSClient(
@@ -226,9 +226,9 @@ enum MODERATION_MODE {
}
"""
Wordlist describes all the available wordlists.
WordList describes all the available wordLists.
"""
type Wordlist {
type WordList {
"""
banned words will by default reject the comment if it is found.
"""
@@ -704,9 +704,9 @@ type Settings {
email: Email! @auth(roles: [ADMIN])
"""
wordlist will return a given list of words.
wordList will return a given list of words.
"""
wordlist: Wordlist! @auth(roles: [ADMIN, MODERATOR])
wordList: WordList! @auth(roles: [ADMIN, MODERATOR])
"""
auth contains all the settings related to authentication and authorization.
@@ -1304,7 +1304,7 @@ input SettingsEmailInput {
fromAddress: String
}
input SettingsWordlistInput {
input SettingsWordListInput {
"""
banned words will by default reject the comment if it is found.
"""
@@ -1641,9 +1641,9 @@ input SettingsInput {
organizationContactEmail: String
"""
wordlist will return a given list of words.
wordList will return a given list of words.
"""
wordlist: SettingsWordlistInput
wordList: SettingsWordListInput
"""
email is the set of credentials and settings associated with the organization.
+3 -3
View File
@@ -6,7 +6,7 @@ import {
GQLKarma,
GQLMODERATION_MODE,
GQLReactionConfiguration,
GQLWordlist,
GQLWordList,
} from "talk-server/graph/tenant/schema/__generated__/types";
// export interface EmailDomainRuleCondition {
@@ -89,9 +89,9 @@ export interface Settings extends ModerationSettings {
karma: GQLKarma;
/**
* wordlist stores all the banned/suspect words.
* wordList stores all the banned/suspect words.
*/
wordlist: GQLWordlist;
wordList: GQLWordList;
/**
* Set of configured authentication integrations.
+1 -1
View File
@@ -75,7 +75,7 @@ export async function createTenant(mongo: Db, input: CreateTenantInput) {
charCount: {
enabled: false,
},
wordlist: {
wordList: {
suspect: [],
banned: [],
},
@@ -92,7 +92,6 @@ export async function create(
// Insert and handle creating the actions.
comment = await addCommentActions(mongo, tenant, comment, inputs);
// asse
}
if (input.parent_id) {
@@ -1,15 +1,15 @@
import { IntermediateModerationPhase } from "talk-server/services/comments/moderation";
import { premod } from "talk-server/services/comments/moderation/phases/premod";
import { toxic } from "talk-server/services/comments/moderation/phases/toxic";
import { assetClosed } from "./assetClosed";
import { commentingDisabled } from "./commentingDisabled";
import { commentLength } from "./commentLength";
import { karma } from "./karma";
import { links } from "./links";
import { preModerate } from "./preModerate";
import { spam } from "./spam";
import { staff } from "./staff";
import { wordlist } from "./wordlist";
import { toxic } from "./toxic";
import { wordList } from "./wordList";
/**
* The moderation phases to apply for each comment being processed.
@@ -18,11 +18,11 @@ export const moderationPhases: IntermediateModerationPhase[] = [
commentLength,
assetClosed,
commentingDisabled,
wordlist,
wordList,
staff,
links,
karma,
spam,
toxic,
premod,
preModerate,
];
@@ -13,7 +13,7 @@ const testModerationMode = (settings: Partial<ModerationSettings>) =>
// This phase checks to see if the settings have premod enabled, if they do,
// the comment is premod, otherwise, it's just none.
export const premod: IntermediateModerationPhase = ({
export const preModerate: IntermediateModerationPhase = ({
asset,
tenant,
}): IntermediatePhaseResult | void => {
@@ -9,8 +9,8 @@ import {
} from "talk-server/services/comments/moderation";
import { containsMatchingPhrase } from "talk-server/services/comments/moderation/wordlist";
// This phase checks the comment against the wordlist.
export const wordlist: IntermediateModerationPhase = ({
// This phase checks the comment against the wordList.
export const wordList: IntermediateModerationPhase = ({
tenant,
comment,
}): IntermediatePhaseResult | void => {
@@ -21,9 +21,9 @@ export const wordlist: IntermediateModerationPhase = ({
// Decide the status based on whether or not the current asset/settings
// has pre-mod enabled or not. If the comment was rejected based on the
// wordlist, then reject it, otherwise if the moderation setting is
// wordList, then reject it, otherwise if the moderation setting is
// premod, set it to `premod`.
if (containsMatchingPhrase(tenant.wordlist.banned, comment.body)) {
if (containsMatchingPhrase(tenant.wordList.banned, comment.body)) {
// Add the flag related to Trust to the comment.
return {
status: GQLCOMMENT_STATUS.REJECTED,
@@ -42,7 +42,7 @@ export const wordlist: IntermediateModerationPhase = ({
// If the wordlist has matched the suspect word filter and we haven't disabled
// auto-flagging suspect words, then we should flag the comment!
if (containsMatchingPhrase(tenant.wordlist.suspect, comment.body)) {
if (containsMatchingPhrase(tenant.wordList.suspect, comment.body)) {
return {
actions: [
{