Files
talk/src/core/server/models/settings.ts
T
Nick Funk 54296fa484 [CORL-645] Add Slack support for v5 (#2713)
* Create preliminary schema for setting Slack channels

CORL-645

* Implement preliminary slack notification using tenant slack channels

CORL-645

* Very preliminarily get data loading with FieldArray's for slack channels

CORL-645

* Update settings input on schema to allow saving Slack settings to tenant

CORL-645

* Filter off UNMODERATED queue events from slack channels

We don't send these to slack through our filters, we only care
about pending, reported, and featured

CORL-645

* Include a moderation link in comments pushed to Slack

CORL-645

* Hook up proper callback functions for adding/removing slack channels

CORL-645

* Add missing translation for Slack navigation item

CORL-645

* Update snapshots for preliminary Slack configuration changes

CORL-645

* Add some FormField wrappers around slack config elements

Makes the UI appear a little nicer

CORL-645

* Set up slack config to only provide one slack channel

We need to do this until we can get ArrayField's working
in final-form.

CORL-645

* Disable the other trigger checkboxes when "All Comments" is checked

CORL-645

* Clean up the formatting of Slack messages

CORL-645

* Add error handling around sending comments to Slack

CORL-645

* Add links to external Slack setup documentation

CORL-645

* Replace form state with wrapped field element

CORL-645

* Clean up fetch request sending Slack notifications

CORL-645

* Prefer global string replacement over RegEx

CORL-645

* Use URL class to construct comment URL's

CORL-645

* Require slack configuration in schema

CORL-645

* Initialize Slack in fixtures

Also fix up a flaky test that wasn't waiting
on form submission and on-change events.

CORL-645

* Preliminarily fix up styles to match other config pages

CORL-645

* Create placeholder add/remove buttons

* Convert SlackConfigContainer to FunctionalComponent

CORL-645

* Add name field to slack channels

CORL-645

* Disable inner fields on Slack channel when not enabled

CORL-645

* Improve the delete channel button

CORL-645

* Use pureMerge to extract slack channel settings

CORL-645

* Do a bit of cleanup on the add channel button

CORL-645
2019-12-03 16:06:38 -05:00

169 lines
3.8 KiB
TypeScript

import { Omit } from "coral-common/types";
import {
GQLAuth,
GQLAuthenticationTargetFilter,
GQLEmailConfiguration,
GQLFacebookAuthIntegration,
GQLGoogleAuthIntegration,
GQLLiveConfiguration,
GQLLocalAuthIntegration,
GQLMODERATION_MODE,
GQLOIDCAuthIntegration,
GQLSettings,
} from "coral-server/graph/tenant/schema/__generated__/types";
export type LiveConfiguration = Omit<GQLLiveConfiguration, "configurable">;
export type EmailConfiguration = GQLEmailConfiguration;
export interface GlobalModerationSettings {
live: LiveConfiguration;
moderation: GQLMODERATION_MODE;
premodLinksEnable: boolean;
}
export type OIDCAuthIntegration = Omit<
GQLOIDCAuthIntegration,
"callbackURL" | "redirectURL"
>;
export type GoogleAuthIntegration = Omit<
GQLGoogleAuthIntegration,
"callbackURL" | "redirectURL"
>;
export type FacebookAuthIntegration = Omit<
GQLFacebookAuthIntegration,
"callbackURL" | "redirectURL"
>;
export interface SSOKey {
/**
* kid is the identifier for the key used when verifying tokens issued by the
* provider.
*/
kid: string;
/**
* secret is the actual underlying secret used to verify the tokens with.
*/
secret: string;
/**
* createdAt is the date that the key was created at.
*/
createdAt: Date;
/**
* rotatedAt is the time that the token was rotated out.
*/
rotatedAt?: Date;
/**
* inactiveAt is the date that the token can no longer be used to validate
* tokens.
*/
inactiveAt?: Date;
}
export interface SSOAuthIntegration {
enabled: boolean;
allowRegistration: boolean;
targetFilter: GQLAuthenticationTargetFilter;
keys: SSOKey[];
}
/**
* AuthIntegrations are the set of configurations for the variations of
* authentication solutions.
*/
export interface AuthIntegrations {
local: GQLLocalAuthIntegration;
sso: SSOAuthIntegration;
oidc: OIDCAuthIntegration;
google: GoogleAuthIntegration;
facebook: FacebookAuthIntegration;
}
/**
* AccountFeatures are features enabled for commenter accounts
*/
export interface AccountFeatures {
changeUsername: boolean;
deleteAccount: boolean;
downloadComments: boolean;
}
/**
* Auth is the set of configured authentication integrations.
*/
export type Auth = Omit<GQLAuth, "integrations"> & {
/**
* integrations are the set of configurations for the variations of
* authentication solutions.
*/
integrations: AuthIntegrations;
};
/**
* CloseCommenting contains settings related to the automatic closing of commenting on
* Stories.
*/
export type CloseCommenting = Omit<GQLSettings["closeCommenting"], "message"> &
Partial<Pick<GQLSettings["closeCommenting"], "message">>;
/**
* DisableCommenting will disable commenting site-wide.
*/
export type DisableCommenting = Omit<
GQLSettings["disableCommenting"],
"message"
> &
Partial<Pick<GQLSettings["disableCommenting"], "message">>;
export type Settings = GlobalModerationSettings &
Pick<
GQLSettings,
| "charCount"
| "email"
| "recentCommentHistory"
| "wordList"
| "integrations"
| "reaction"
| "staff"
| "editCommentWindowLength"
| "customCSSURL"
| "communityGuidelines"
| "stories"
| "createdAt"
| "slack"
> & {
/**
* auth is the set of configured authentication integrations.
*/
auth: Auth;
/**
* email is the set of credentials and settings associated with the
* organization.
*/
email: EmailConfiguration;
/**
* closeCommenting contains settings related to the automatic closing of commenting on
* Stories.
*/
closeCommenting: CloseCommenting;
/**
* disableCommenting will disable commenting site-wide.
*/
disableCommenting: DisableCommenting;
/**
* AccountFeatures are features enabled for commenter accounts
*/
accountFeatures: AccountFeatures;
};