From 581d6e7da3911c78cf6db09f34aab3dfb81ee7d7 Mon Sep 17 00:00:00 2001 From: tecc Date: Tue, 3 Oct 2023 05:24:49 +0200 Subject: [PATCH] change(rewrite): Small changes in rewrite history-generator: The `historyDefaultsToWeirdGeneratorThing` has been renamed to `isUserGenerated`, and the expression for setting `history` to `__generator__` has been changed. See https://gitlab.com/PronounsPage/PronounsPage/-/merge_requests/373#note_1577573480. cleaning: Formatted a few files and cleaned them up. --- new/backend/src/config.ts | 2 +- new/backend/src/global.d.ts | 2 -- new/backend/src/server/v1.ts | 10 +++------- new/backend/src/server/v1/pronouns.ts | 2 +- new/common/src/suml.ts | 1 - 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/new/backend/src/config.ts b/new/backend/src/config.ts index cabd5ab76..c0cf2f6c2 100644 --- a/new/backend/src/config.ts +++ b/new/backend/src/config.ts @@ -24,7 +24,7 @@ export interface Config { }; database: { url: string; - } + }; security: { secret: string; }; diff --git a/new/backend/src/global.d.ts b/new/backend/src/global.d.ts index b6fb58942..5649183aa 100644 --- a/new/backend/src/global.d.ts +++ b/new/backend/src/global.d.ts @@ -1,9 +1,7 @@ import type { FastifyInstance, FastifyPluginAsync, - // FastifyPluginCallback, FastifyPluginOptions, - FastifyRequest, FastifyReply, RawReplyDefaultExpression, RawRequestDefaultExpression, diff --git a/new/backend/src/server/v1.ts b/new/backend/src/server/v1.ts index 45cba5538..ef3cdcd1f 100644 --- a/new/backend/src/server/v1.ts +++ b/new/backend/src/server/v1.ts @@ -60,8 +60,7 @@ export const localeSpecific = Type.Object({ export interface TransformPronounOptions { processName: boolean; - // I know it's a long name but it's very descriptive. - historyDefaultsToWeirdGeneratorThing: boolean; + isUserGenerated: boolean; } export function transformPronoun( pronoun: Pronoun, @@ -71,8 +70,7 @@ export function transformPronoun( ) { const opts: TransformPronounOptions = { processName: options?.processName ?? false, - historyDefaultsToWeirdGeneratorThing: - options?.historyDefaultsToWeirdGeneratorThing ?? false, + isUserGenerated: options?.isUserGenerated ?? false, }; const morphemes: Record = {}; const pronunciations: Record = {}; @@ -91,9 +89,7 @@ export function transformPronoun( plural: [pronoun.isPlural], pluralHonorific: [pronoun.isPluralHonorific], aliases: pronoun.keys.slice(1), - history: - pronoun.history ?? - (opts.historyDefaultsToWeirdGeneratorThing ? "__generator__" : ""), + history: opts.isUserGenerated ? "__generator__" : pronoun.history ?? "", pronounceable: pronoun.isPronounceable, thirdForm: pronoun.thirdForm ?? null, smallForm: pronoun.smallForm ?? null, diff --git a/new/backend/src/server/v1/pronouns.ts b/new/backend/src/server/v1/pronouns.ts index a76a6cf4a..73afcc029 100644 --- a/new/backend/src/server/v1/pronouns.ts +++ b/new/backend/src/server/v1/pronouns.ts @@ -93,7 +93,7 @@ export const plugin = async function (app: AppInstance) { locale, { processName: true, - historyDefaultsToWeirdGeneratorThing: true, + isUserGenerated: true, } ); } diff --git a/new/common/src/suml.ts b/new/common/src/suml.ts index 8c0775a84..78dd9ee86 100644 --- a/new/common/src/suml.ts +++ b/new/common/src/suml.ts @@ -2,7 +2,6 @@ import * as SumlImpl from "suml"; declare module "suml"; -console.log(SumlImpl); const instance = new SumlImpl.default(); export function parse(value: string): unknown {