refactor: unify channel config matching and gating
Co-authored-by: thewilloftheshadow <thewilloftheshadow@users.noreply.github.com>
This commit is contained in:
@@ -31,6 +31,8 @@ describe("msteams policy", () => {
|
||||
expect(res.channelConfig?.requireMention).toBe(true);
|
||||
expect(res.allowlistConfigured).toBe(true);
|
||||
expect(res.allowed).toBe(true);
|
||||
expect(res.channelMatchKey).toBe("chan456");
|
||||
expect(res.channelMatchSource).toBe("direct");
|
||||
});
|
||||
|
||||
it("returns undefined configs when teamId is missing", () => {
|
||||
|
||||
@@ -13,6 +13,8 @@ export type MSTeamsResolvedRouteConfig = {
|
||||
allowed: boolean;
|
||||
teamKey?: string;
|
||||
channelKey?: string;
|
||||
channelMatchKey?: string;
|
||||
channelMatchSource?: "direct" | "wildcard";
|
||||
};
|
||||
|
||||
export function resolveMSTeamsRouteConfig(params: {
|
||||
@@ -75,6 +77,8 @@ export function resolveMSTeamsRouteConfig(params: {
|
||||
allowed,
|
||||
teamKey,
|
||||
channelKey,
|
||||
channelMatchKey: channelKey,
|
||||
channelMatchSource: channelKey ? (channelKey === "*" ? "wildcard" : "direct") : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user