mirror of
https://github.com/wassname/talk.git
synced 2026-09-12 13:01:11 +08:00
[CORL-681] Configurable Staff Badges (#2620)
* feat: added configurable staff badge * fix: removed ambigous styles
This commit is contained in:
@@ -94,6 +94,7 @@ export type Settings = GlobalModerationSettings &
|
||||
| "wordList"
|
||||
| "integrations"
|
||||
| "reaction"
|
||||
| "staff"
|
||||
| "editCommentWindowLength"
|
||||
| "customCSSURL"
|
||||
| "communityGuidelines"
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import crypto from "crypto";
|
||||
import { FluentBundle } from "fluent/compat";
|
||||
|
||||
import { GQLReactionConfiguration } from "coral-server/graph/tenant/schema/__generated__/types";
|
||||
import {
|
||||
GQLReactionConfiguration,
|
||||
GQLStaffConfiguration,
|
||||
} from "coral-server/graph/tenant/schema/__generated__/types";
|
||||
import { translate } from "coral-server/services/i18n";
|
||||
|
||||
export const getDefaultReactionConfiguration = (
|
||||
@@ -19,6 +22,12 @@ export const getDefaultReactionConfiguration = (
|
||||
icon: "thumb_up",
|
||||
});
|
||||
|
||||
export const getDefaultStaffConfiguration = (
|
||||
bundle: FluentBundle
|
||||
): GQLStaffConfiguration => ({
|
||||
label: translate(bundle, "Staff", "staff-label"),
|
||||
});
|
||||
|
||||
export function generateSSOKey() {
|
||||
// Generate a new key. We generate a key of minimum length 32 up to 37 bytes,
|
||||
// as 16 was the minimum length recommended.
|
||||
|
||||
@@ -13,7 +13,11 @@ import { Settings } from "coral-server/models/settings";
|
||||
import { I18n } from "coral-server/services/i18n";
|
||||
import { tenants as collection } from "coral-server/services/mongodb/collections";
|
||||
|
||||
import { generateSSOKey, getDefaultReactionConfiguration } from "./helpers";
|
||||
import {
|
||||
generateSSOKey,
|
||||
getDefaultReactionConfiguration,
|
||||
getDefaultStaffConfiguration,
|
||||
} from "./helpers";
|
||||
|
||||
/**
|
||||
* TenantResource references a given resource that should be owned by a specific
|
||||
@@ -64,6 +68,9 @@ export async function createTenant(
|
||||
input: CreateTenantInput,
|
||||
now = new Date()
|
||||
) {
|
||||
// Get the tenant's bundle.
|
||||
const bundle = i18n.getBundle(input.locale);
|
||||
|
||||
const defaults: Sub<Tenant, CreateTenantInput> = {
|
||||
// Create a new ID.
|
||||
id: uuid.v4(),
|
||||
@@ -168,7 +175,8 @@ export async function createTenant(
|
||||
doNotStore: true,
|
||||
},
|
||||
},
|
||||
reaction: getDefaultReactionConfiguration(i18n.getBundle(input.locale)),
|
||||
reaction: getDefaultReactionConfiguration(bundle),
|
||||
staff: getDefaultStaffConfiguration(bundle),
|
||||
stories: {
|
||||
scraping: {
|
||||
enabled: true,
|
||||
|
||||
Reference in New Issue
Block a user