mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-20 20:44:58 +00:00
Matrix: fix validated review comments
This commit is contained in:
@@ -242,6 +242,28 @@ describe("pairing cli", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("uses the approved request accountId for notifications when --account is omitted", async () => {
|
||||
approveChannelPairingCode.mockResolvedValueOnce({
|
||||
id: "123",
|
||||
entry: {
|
||||
id: "123",
|
||||
code: "ABCDEFGH",
|
||||
createdAt: "2026-01-08T00:00:00Z",
|
||||
lastSeenAt: "2026-01-08T00:00:00Z",
|
||||
meta: { accountId: "ops" },
|
||||
},
|
||||
});
|
||||
|
||||
await runPairing(["pairing", "approve", "--channel", "telegram", "--notify", "ABCDEFGH"]);
|
||||
|
||||
expect(notifyPairingApproved).toHaveBeenCalledWith({
|
||||
channelId: "telegram",
|
||||
id: "123",
|
||||
cfg: {},
|
||||
accountId: "ops",
|
||||
});
|
||||
});
|
||||
|
||||
it("defaults approve to the sole available channel when only code is provided", async () => {
|
||||
listPairingChannels.mockReturnValueOnce(["slack"]);
|
||||
mockApprovedPairing();
|
||||
|
||||
@@ -166,8 +166,11 @@ export function registerPairingCli(program: Command) {
|
||||
if (!opts.notify) {
|
||||
return;
|
||||
}
|
||||
await notifyApproved(channel, approved.id, accountId || undefined).catch((err) => {
|
||||
defaultRuntime.log(theme.warn(`Failed to notify requester: ${String(err)}`));
|
||||
});
|
||||
const approvedAccountId = String(approved.entry?.meta?.accountId ?? "").trim();
|
||||
await notifyApproved(channel, approved.id, accountId || approvedAccountId || undefined).catch(
|
||||
(err) => {
|
||||
defaultRuntime.log(theme.warn(`Failed to notify requester: ${String(err)}`));
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user