点赞和改造开关加入后台配置

This commit is contained in:
2026-06-10 14:36:56 +08:00
parent 9db467d23f
commit e29992cf01
33 changed files with 1644 additions and 380 deletions

View File

@@ -12,6 +12,7 @@ pub struct CreationEntryConfigResponse {
pub type_modal: CreationEntryTypeModalResponse,
pub event_banner: CreationEntryEventBannerResponse,
pub event_banners: Vec<CreationEntryEventBannerResponse>,
pub public_work_interactions: Vec<PublicWorkInteractionConfigResponse>,
pub creation_types: Vec<CreationEntryTypeResponse>,
}
@@ -57,6 +58,20 @@ pub fn default_creation_entry_event_banner_render_mode() -> String {
"structured".to_string()
}
/// 单类公开作品互动能力配置。
///
/// 后台可以关闭已接入的点赞 / 改造能力;未接入后端动作的玩法即使误开,
/// 前端仍会按实际能力矩阵返回不可用提示。
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct PublicWorkInteractionConfigResponse {
pub source_type: String,
pub like_enabled: bool,
pub remix_enabled: bool,
pub like_disabled_message: String,
pub remix_disabled_message: String,
}
/// 单个创作模板入口配置,决定底部加号入口中的分类、排序和开放状态。
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
@@ -547,6 +562,13 @@ mod tests {
render_mode: "html".to_string(),
html_code: Some("<section>ok</section>".to_string()),
}],
public_work_interactions: vec![PublicWorkInteractionConfigResponse {
source_type: "puzzle".to_string(),
like_enabled: true,
remix_enabled: true,
like_disabled_message: "拼图点赞暂不可用。".to_string(),
remix_disabled_message: "拼图作品改造暂不可用。".to_string(),
}],
creation_types: Vec::new(),
};
let value = serde_json::to_value(response).expect("response should serialize");
@@ -558,5 +580,6 @@ mod tests {
);
assert!(value.get("event_banner").is_none());
assert!(value.get("eventBanner").is_some());
assert_eq!(value["publicWorkInteractions"][0]["sourceType"], "puzzle");
}
}