fix(external-entry): preserve legacy private room links
Docker Image / Build and Push Docker Image (push) Successful in 2m12s

This commit is contained in:
Codex
2026-07-27 11:28:27 +08:00
parent bb1f0d225c
commit 9602fdd94d
5 changed files with 89 additions and 36 deletions
+1
View File
@@ -6,6 +6,7 @@
* `/external-entry?target=chat&mode=promotion&promotion_type=voice`
* `/external-entry?target=chat&character=maya`
* `/external-entry?target=tip`
* `/external-entry?target=private-zone&character=nayeli`
*
* 页面不直接 `redirect()`,而是把数据交给 Client 组件先写入本地存储,
* 再通过 `router.replace()` 清理 URL 并跳转到最终页面。
@@ -14,12 +14,15 @@ describe("external entry navigation", () => {
expect(resolveExternalEntryTarget({})).toBe(ROUTES.chat);
});
it("resolves only canonical targets", () => {
it("resolves canonical targets and the published private-room alias", () => {
expect(resolveExternalEntryTarget({ target: "chat" })).toBe(ROUTES.chat);
expect(resolveExternalEntryTarget({ target: "tip" })).toBe(ROUTES.tip);
expect(resolveExternalEntryTarget({ target: "private-zone" })).toBe(
ROUTES.privateZone,
);
expect(resolveExternalEntryTarget({ target: "private-room" })).toBe(
ROUTES.privateZone,
);
});
it("rejects removed aliases and unsupported targets", () => {
@@ -49,6 +52,28 @@ describe("external entry navigation", () => {
}),
).toBe(getCharacterRoutes("elio").privateZone);
});
it.each([
["chat", "elio", getCharacterRoutes("elio").chat],
["chat", "maya", getCharacterRoutes("maya").chat],
["chat", "nayeli", getCharacterRoutes("nayeli").chat],
["tip", "elio", getCharacterRoutes("elio").tip],
["tip", "maya", getCharacterRoutes("maya").tip],
["tip", "nayeli", getCharacterRoutes("nayeli").tip],
["private-zone", "elio", getCharacterRoutes("elio").privateZone],
["private-zone", "maya", getCharacterRoutes("maya").privateZone],
["private-zone", "nayeli", getCharacterRoutes("nayeli").privateZone],
["private-room", "elio", getCharacterRoutes("elio").privateZone],
["private-room", "maya", getCharacterRoutes("maya").privateZone],
["private-room", "nayeli", getCharacterRoutes("nayeli").privateZone],
])(
"routes target=%s character=%s to %s",
(target, character, expectedDestination) => {
expect(resolveExternalEntryDestination({ target, character })).toBe(
expectedDestination,
);
},
);
});
describe("external entry facebook identity binding", () => {
+3 -1
View File
@@ -129,7 +129,9 @@ function resolveTarget(
if (target === "chat") return ROUTES.chat;
if (target === "tip") return ROUTES.tip;
if (target === "private-zone") return ROUTES.privateZone;
if (target === "private-zone" || target === "private-room") {
return ROUTES.privateZone;
}
return null;
}