fix: polish bark battle creation flow

This commit is contained in:
kdletters
2026-05-22 05:00:07 +08:00
parent 01da85a577
commit bf82f04b64
73 changed files with 9362 additions and 2663 deletions

View File

@@ -180,17 +180,7 @@ fn seed_creation_entry_config_if_missing(ctx: &ReducerContext) {
}
migrate_visual_novel_entry_from_old_visible_default(ctx, now);
migrate_coming_soon_entry_from_old_open_default(
ctx,
now,
ComingSoonEntryDefault {
id: "bark-battle",
title: "汪汪声浪",
subtitle: "声控对战挑战",
image_src: "/creation-type-references/creative-agent.webp",
sort_order: 85,
},
);
migrate_bark_battle_entry_to_open_default(ctx, now);
migrate_coming_soon_entry_from_old_open_default(
ctx,
now,
@@ -204,6 +194,36 @@ fn seed_creation_entry_config_if_missing(ctx: &ReducerContext) {
);
}
fn migrate_bark_battle_entry_to_open_default(ctx: &ReducerContext, now: Timestamp) {
let id = "bark-battle".to_string();
let Some(row) = ctx.db.creation_entry_type_config().id().find(&id) else {
return;
};
// 中文注释:只纠偏系统默认汪汪声浪入口,不覆盖后台手动改过标题、排序或可见性的配置。
let still_system_default = row.title == "汪汪声浪"
&& row.subtitle == "声控对战挑战"
&& row.visible
&& row.sort_order == 85
&& (row.image_src == "/creation-type-references/creative-agent.webp"
|| row.image_src == "/creation-type-references/bark-battle.webp")
&& ((row.badge == "敬请期待" && !row.open) || (row.badge == "可创建" && row.open));
if !still_system_default {
return;
}
ctx.db
.creation_entry_type_config()
.id()
.update(CreationEntryTypeConfig {
badge: "可创建".to_string(),
image_src: "/creation-type-references/bark-battle.webp".to_string(),
open: true,
updated_at: now,
..row
});
}
fn migrate_visual_novel_entry_from_old_visible_default(ctx: &ReducerContext, now: Timestamp) {
let id = "visual-novel".to_string();
let Some(row) = ctx.db.creation_entry_type_config().id().find(&id) else {