about summary refs log tree commit diff
path: root/src/view/lib/strings.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/view/lib/strings.ts')
-rw-r--r--src/view/lib/strings.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/view/lib/strings.ts b/src/view/lib/strings.ts
index df134e37b..6d963b281 100644
--- a/src/view/lib/strings.ts
+++ b/src/view/lib/strings.ts
@@ -57,11 +57,17 @@ export function ago(date: number | string | Date): string {
   }
 }
 
-export function extractEntities(text: string): Entity[] | undefined {
+export function extractEntities(
+  text: string,
+  knownHandles?: Set<string>,
+): Entity[] | undefined {
   let match
   let ents: Entity[] = []
   const re = /(^|\s)(@)([a-zA-Z0-9\.-]+)(\b)/dg
   while ((match = re.exec(text))) {
+    if (knownHandles && !knownHandles.has(match[3])) {
+      continue // not a known handle
+    }
     ents.push({
       type: 'mention',
       value: match[3],