Implement typed chat mention resolution
This commit is contained in:
1 parent
df9317ef4b
commit
0b19a152e6
4 files changed
+234
-7
No files matched your search
@@ -0,0 +1,11 @@
|
||||
export const RESERVED_MENTION_HANDLES = new Set(["board", "oncall"]);
|
||||
|
||||
export function canonicalMentionHandle(value: string): string {
|
||||
return value.toLowerCase().replace(/[^a-z0-9]/g, "");
|
||||
}
|
||||
|
||||
export function assertUsableMentionName(value: string): void {
|
||||
if (RESERVED_MENTION_HANDLES.has(canonicalMentionHandle(value))) {
|
||||
throw new Error("Mention handle is reserved.");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user