fix: restore discord owner hint from allowlists

This commit is contained in:
Peter Steinberger
2026-02-04 23:34:08 -08:00
parent 8524666454
commit d84eb46467
8 changed files with 89 additions and 7 deletions

View File

@@ -167,6 +167,29 @@ describe("resolveCommandAuthorization", () => {
expect(otherAuth.senderIsOwner).toBe(false);
expect(otherAuth.isAuthorizedSender).toBe(false);
});
it("uses owner allowlist override from context when configured", () => {
const cfg = {
channels: { discord: {} },
} as OpenClawConfig;
const ctx = {
Provider: "discord",
Surface: "discord",
From: "discord:123",
SenderId: "123",
OwnerAllowFrom: ["discord:123"],
} as MsgContext;
const auth = resolveCommandAuthorization({
ctx,
cfg,
commandAuthorized: true,
});
expect(auth.senderIsOwner).toBe(true);
expect(auth.ownerList).toEqual(["123"]);
});
});
describe("control command parsing", () => {