mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-16 20:40:45 +00:00
Plugins: migrate legacy binding ids
This commit is contained in:
@@ -387,10 +387,10 @@ describe("plugin conversation binding approvals", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("migrates a legacy plugin binding record through the new approval flow", async () => {
|
||||
it("migrates a legacy plugin binding record through the new approval flow even if the old plugin id differs", async () => {
|
||||
sessionBindingState.setRecord({
|
||||
bindingId: "binding-legacy",
|
||||
targetSessionKey: "plugin-binding:codex:legacy123",
|
||||
targetSessionKey: "plugin-binding:old-codex-plugin:legacy123",
|
||||
targetKind: "session",
|
||||
conversation: {
|
||||
channel: "telegram",
|
||||
|
||||
@@ -204,13 +204,12 @@ function isLegacyPluginBindingRecord(params: {
|
||||
}
|
||||
| null
|
||||
| undefined;
|
||||
pluginId: string;
|
||||
}): boolean {
|
||||
if (!params.record || isPluginOwnedBindingMetadata(params.record.metadata)) {
|
||||
return false;
|
||||
}
|
||||
const targetSessionKey = params.record.targetSessionKey.trim();
|
||||
return targetSessionKey.startsWith(`${PLUGIN_BINDING_SESSION_PREFIX}:${params.pluginId}:`);
|
||||
return targetSessionKey.startsWith(`${PLUGIN_BINDING_SESSION_PREFIX}:`);
|
||||
}
|
||||
|
||||
function buildDiscordButtonRow(
|
||||
@@ -544,7 +543,6 @@ export async function requestPluginConversationBinding(params: {
|
||||
const existingPluginBinding = toPluginConversationBinding(existing);
|
||||
const existingLegacyPluginBinding = isLegacyPluginBindingRecord({
|
||||
record: existing,
|
||||
pluginId: params.pluginId,
|
||||
});
|
||||
if (existing && !existingPluginBinding) {
|
||||
if (existingLegacyPluginBinding) {
|
||||
|
||||
Reference in New Issue
Block a user