ui: fix preferenceLang display on problem submit (#573)

pull/579/head
panda 1 year ago committed by GitHub
parent 72faf6c8d3
commit 855db6b64a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,7 +13,7 @@ const page = new NamedPage(['problem_submit', 'contest_detail_problem_submit', '
} }
const availableLangs = getAvailableLangs(config.langs); const availableLangs = getAvailableLangs(config.langs);
const mainLangs = {}; const mainLangs = {};
const preferences = [($('[name="lang"]').val() as string) || '']; const preferences = [UserContext.codeLang || ''];
for (const key in availableLangs) { for (const key in availableLangs) {
if (config.langs && !config.langs.filter((i) => i === key || i.startsWith(`${key}.`)).length) continue; if (config.langs && !config.langs.filter((i) => i === key || i.startsWith(`${key}.`)).length) continue;
if (window.LANGS[key].pretest === preferences[0]) preferences.push(key); if (window.LANGS[key].pretest === preferences[0]) preferences.push(key);

Loading…
Cancel
Save