refactor: share allowlist match metadata
Co-authored-by: thewilloftheshadow <thewilloftheshadow@users.noreply.github.com>
This commit is contained in:
21
src/channels/allowlist-match.ts
Normal file
21
src/channels/allowlist-match.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
export type AllowlistMatchSource =
|
||||
| "wildcard"
|
||||
| "id"
|
||||
| "name"
|
||||
| "tag"
|
||||
| "username"
|
||||
| "prefixed-id"
|
||||
| "prefixed-user"
|
||||
| "prefixed-name"
|
||||
| "slug"
|
||||
| "localpart";
|
||||
|
||||
export type AllowlistMatch<TSource extends string = AllowlistMatchSource> = {
|
||||
allowed: boolean;
|
||||
matchKey?: string;
|
||||
matchSource?: TSource;
|
||||
};
|
||||
|
||||
export function formatAllowlistMatchMeta(match?: AllowlistMatch | null): string {
|
||||
return `matchKey=${match?.matchKey ?? "none"} matchSource=${match?.matchSource ?? "none"}`;
|
||||
}
|
||||
Reference in New Issue
Block a user