mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-04 12:34:53 +08:00
fix: allow only one funbox changing capitalisation (@fehmer) (#5959)
Fixes funboxes like `capitals` and `instant messaging` not working at the same time.
This commit is contained in:
parent
4f541da111
commit
c7751d9051
2 changed files with 10 additions and 0 deletions
|
@ -136,6 +136,10 @@ export function areFunboxesCompatible(funboxesString: string): boolean {
|
|||
const oneCharReplacerMax =
|
||||
funboxesToCheck.filter((f) => f.frontendFunctions?.includes("getWordHtml"))
|
||||
.length <= 1;
|
||||
const oneChangesCapitalisationMax =
|
||||
funboxesToCheck.filter((f) =>
|
||||
f.properties?.find((fp) => fp === "changesCapitalisation")
|
||||
).length <= 1;
|
||||
const allowedConfig = {} as Record<string, string[] | boolean[]>;
|
||||
let noConfigConflicts = true;
|
||||
for (const f of funboxesToCheck) {
|
||||
|
@ -174,6 +178,7 @@ export function areFunboxesCompatible(funboxesString: string): boolean {
|
|||
onePunctuateWordMax &&
|
||||
oneCharCheckerMax &&
|
||||
oneCharReplacerMax &&
|
||||
oneChangesCapitalisationMax &&
|
||||
noConfigConflicts &&
|
||||
oneWordOrderMax
|
||||
);
|
||||
|
|
|
@ -296,6 +296,10 @@ export function areFunboxesCompatible(
|
|||
funboxesToCheck.filter((f) => f.functions?.isCharCorrect).length <= 1;
|
||||
const oneCharReplacerMax =
|
||||
funboxesToCheck.filter((f) => f.functions?.getWordHtml).length <= 1;
|
||||
const oneChangesCapitalisationMax =
|
||||
funboxesToCheck.filter((f) =>
|
||||
f.properties?.find((fp) => fp === "changesCapitalisation")
|
||||
).length <= 1;
|
||||
const allowedConfig = {} as FunboxForcedConfig;
|
||||
let noConfigConflicts = true;
|
||||
for (const f of funboxesToCheck) {
|
||||
|
@ -335,6 +339,7 @@ export function areFunboxesCompatible(
|
|||
onePunctuateWordMax &&
|
||||
oneCharCheckerMax &&
|
||||
oneCharReplacerMax &&
|
||||
oneChangesCapitalisationMax &&
|
||||
noConfigConflicts
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue