Skip to content

Commit

Permalink
fix: weird behavior when using quote mode with a language that doesnt…
Browse files Browse the repository at this point in the history
… have a base (200) list
  • Loading branch information
Miodec committed Feb 5, 2024
1 parent 1cfce34 commit 6fddc7c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 30 deletions.
8 changes: 7 additions & 1 deletion frontend/src/ts/elements/modes-notice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,14 @@ export async function update(): Promise<void> {
}

if (Config.mode !== "zen") {
let language = Config.language;

if (Config.mode === "quote") {
language = language.split(/_\d+k$/)[0] as string;
}

$(".pageTest #testModesNotice").append(
`<div class="textButton" commands="languages"><i class="fas fa-globe-americas"></i>${Config.language.replace(
`<div class="textButton" commands="languages"><i class="fas fa-globe-americas"></i>${language.replace(
/_/g,
" "
)}</div>`
Expand Down
29 changes: 0 additions & 29 deletions frontend/src/ts/test/test-logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,6 @@ export function restart(options = {} as RestartOptions): void {

let rememberLazyMode: boolean;
let testReinitCount = 0;
let languageBeforeQuoteMode: string | undefined;
export async function init(): Promise<void> {
console.debug("Initializing test");
testReinitCount++;
Expand Down Expand Up @@ -458,34 +457,6 @@ export async function init(): Promise<void> {
if (Config.quoteLength.includes(-3) && !Auth?.currentUser) {
UpdateConfig.setQuoteLength(-1);
}
let group;
try {
group = await Misc.findCurrentGroup(Config.language);
} catch (e) {
console.error(
Misc.createErrorMessage(e, "Failed to find current language group")
);
return;
}
if (
group &&
group.name !== "code" &&
group.name !== "other" &&
group.name !== Config.language
) {
languageBeforeQuoteMode = Config.language;
UpdateConfig.setLanguage(group.name);
}
} else {
if (
languageBeforeQuoteMode &&
Config.language === languageBeforeQuoteMode.split("_")[0]
) {
UpdateConfig.setLanguage(languageBeforeQuoteMode);
languageBeforeQuoteMode = undefined;
await init();
return;
}
}

if (Config.tapeMode !== "off" && language.rightToLeft === true) {
Expand Down

0 comments on commit 6fddc7c

Please sign in to comment.