fix(server): 升级不再关掉老用户的候选词翻译 (#884)

This commit is contained in:
Lu Fan(SonnyCalcr) authored and GitHub committed 2026-10-12 16:47:31 +08:00
1 parent add122fcc6
commit 341ca93be5
2 files changed
+3 -1

No files matched your search

@@ -68,6 +68,7 @@ bool KeepsPreviousDefaultOnUpgrade(const std::string &assignment_id)
{
static const std::set<std::string> kIds = {
MakeTomlAssignmentId("general", "emoji_mixed_input"),
MakeTomlAssignmentId("general", "candidate_translations"),
MakeTomlAssignmentId("input", "default_ime_mode"),
MakeTomlAssignmentId("appearance", "candidate_window_layout"),
MakeTomlAssignmentId("appearance", "candidate_skin"),
@@ -183,7 +183,7 @@ TEST_CASE(shipped_fresh_install_defaults_do_not_flip_upgraded_users)
std::ifstream input(MSIME_DEFAULT_CONFIG_PATH, std::ios::binary);
REQUIRE(static_cast<bool>(input));
const std::string installed((std::istreambuf_iterator<char>(input)), {});
const std::string previous_defaults = "[general]\nemoji_mixed_input = true\n"
const std::string previous_defaults = "[general]\nemoji_mixed_input = true\ncandidate_translations = true\n"
"[input]\ndefault_ime_mode = \"english\"\n"
"[appearance]\ncandidate_window_layout = \"vertical\"\n"
"candidate_skin = \"willow_green\"\n"
@@ -196,6 +196,7 @@ TEST_CASE(shipped_fresh_install_defaults_do_not_flip_upgraded_users)
const auto upgraded = toml::parse(MergeConfigIntoTemplate(installed, previous_defaults, previous_defaults));
REQUIRE(upgraded["general"]["emoji_mixed_input"].value_or(false));
REQUIRE(upgraded["general"]["candidate_translations"].value_or(false));
REQUIRE_EQ(upgraded["input"]["default_ime_mode"].value_or(std::string()), std::string("english"));
REQUIRE_EQ(upgraded["appearance"]["candidate_window_layout"].value_or(std::string()), std::string("vertical"));
REQUIRE_EQ(upgraded["appearance"]["candidate_skin"].value_or(std::string()), std::string("willow_green"));