mirror of
https://github.com/wassname/talk.git
synced 2026-09-10 12:43:11 +08:00
feat: added reaction configuration
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
GQLExternalIntegrations,
|
||||
GQLKarma,
|
||||
GQLMODERATION_MODE,
|
||||
GQLReactionConfiguration,
|
||||
GQLWordlist,
|
||||
} from "talk-server/graph/tenant/schema/__generated__/types";
|
||||
|
||||
@@ -101,4 +102,9 @@ export interface Settings extends ModerationSettings {
|
||||
* Various integrations with external services.
|
||||
*/
|
||||
integrations: GQLExternalIntegrations;
|
||||
|
||||
/**
|
||||
* reaction specifies the configuration for reactions.
|
||||
*/
|
||||
reaction: GQLReactionConfiguration;
|
||||
}
|
||||
|
||||
@@ -49,10 +49,10 @@ export type CreateTenantInput = Pick<
|
||||
/**
|
||||
* create will create a new Tenant.
|
||||
*
|
||||
* @param db the MongoDB connection used to create the tenant.
|
||||
* @param mongo the MongoDB connection used to create the tenant.
|
||||
* @param input the customizable parts of the Tenant available during creation
|
||||
*/
|
||||
export async function createTenant(db: Db, input: CreateTenantInput) {
|
||||
export async function createTenant(mongo: Db, input: CreateTenantInput) {
|
||||
const defaults: Sub<Tenant, CreateTenantInput> = {
|
||||
// Create a new ID.
|
||||
id: uuid.v4(),
|
||||
@@ -115,6 +115,12 @@ export async function createTenant(db: Db, input: CreateTenantInput) {
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
reaction: {
|
||||
// By default, the standard reaction style will use the Respect with the
|
||||
// handshake.
|
||||
label: "Respect",
|
||||
icon: "handshake",
|
||||
},
|
||||
};
|
||||
|
||||
// Create the new Tenant by merging it together with the defaults.
|
||||
@@ -124,7 +130,7 @@ export async function createTenant(db: Db, input: CreateTenantInput) {
|
||||
};
|
||||
|
||||
// Insert the Tenant into the database.
|
||||
await collection(db).insert(tenant);
|
||||
await collection(mongo).insert(tenant);
|
||||
|
||||
return tenant;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user