fix: stabilize rpg creation entry and opening cg
This commit is contained in:
@@ -2562,6 +2562,18 @@ fn upsert_nested_result_profile_id(
|
||||
}
|
||||
}
|
||||
|
||||
fn resolve_publish_world_setting_text(
|
||||
payload: &JsonMap<String, JsonValue>,
|
||||
draft_profile: &JsonMap<String, JsonValue>,
|
||||
session: &CustomWorldAgentSession,
|
||||
) -> String {
|
||||
module_custom_world::resolve_custom_world_publish_setting_text(
|
||||
payload,
|
||||
draft_profile,
|
||||
&session.seed_text,
|
||||
)
|
||||
}
|
||||
|
||||
fn is_same_agent_draft_profile_candidate(
|
||||
row: &CustomWorldProfile,
|
||||
owner_user_id: &str,
|
||||
@@ -2608,13 +2620,7 @@ fn execute_publish_world_action(
|
||||
.filter(|value| !value.is_empty())
|
||||
.map(ToOwned::to_owned)
|
||||
.unwrap_or_else(|| gate.profile_id.clone());
|
||||
let setting_text = payload
|
||||
.get("settingText")
|
||||
.and_then(JsonValue::as_str)
|
||||
.map(str::trim)
|
||||
.filter(|value| !value.is_empty())
|
||||
.map(ToOwned::to_owned)
|
||||
.unwrap_or_else(|| session.seed_text.clone());
|
||||
let setting_text = resolve_publish_world_setting_text(payload, &draft_profile, session);
|
||||
let legacy_result_profile_json = payload
|
||||
.get("legacyResultProfile")
|
||||
.map(serialize_json_value)
|
||||
|
||||
@@ -179,6 +179,7 @@ fn seed_creation_entry_config_if_missing(ctx: &ReducerContext) {
|
||||
}
|
||||
}
|
||||
|
||||
migrate_rpg_entry_from_old_hidden_default(ctx, now);
|
||||
migrate_visual_novel_entry_from_old_visible_default(ctx, now);
|
||||
migrate_coming_soon_entry_from_old_open_default(
|
||||
ctx,
|
||||
@@ -204,6 +205,36 @@ fn seed_creation_entry_config_if_missing(ctx: &ReducerContext) {
|
||||
);
|
||||
}
|
||||
|
||||
fn migrate_rpg_entry_from_old_hidden_default(ctx: &ReducerContext, now: Timestamp) {
|
||||
let id = "rpg".to_string();
|
||||
let Some(row) = ctx.db.creation_entry_type_config().id().find(&id) else {
|
||||
return;
|
||||
};
|
||||
|
||||
// 中文注释:只开放历史默认隐藏的 RPG 入口,不覆盖后台入口开关后续手动配置。
|
||||
let still_old_hidden_default = row.title == "文字冒险"
|
||||
&& row.subtitle == "经典 RPG 体验"
|
||||
&& row.badge == "内测"
|
||||
&& row.image_src == "/creation-type-references/rpg.webp"
|
||||
&& !row.visible
|
||||
&& row.open
|
||||
&& row.sort_order == 10;
|
||||
if !still_old_hidden_default {
|
||||
return;
|
||||
}
|
||||
|
||||
ctx.db
|
||||
.creation_entry_type_config()
|
||||
.id()
|
||||
.update(CreationEntryTypeConfig {
|
||||
badge: "可创建".to_string(),
|
||||
visible: true,
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user