about summary refs log tree commit diff
path: root/src/state/lib/api.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-12-06 13:47:52 -0600
committerPaul Frazee <pfrazee@gmail.com>2022-12-06 13:47:52 -0600
commitae522c86fe41c1449fe28972eeb45be6074ef227 (patch)
tree45f104251fa36af6caa5b8bd903c84625f528938 /src/state/lib/api.ts
parent1a11c13fce6818b54ee251f7fe9870907a7c9aea (diff)
downloadvoidsky-ae522c86fe41c1449fe28972eeb45be6074ef227.tar.zst
Fix mention-creation and implement mentions in notifications
Diffstat (limited to 'src/state/lib/api.ts')
-rw-r--r--src/state/lib/api.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/state/lib/api.ts b/src/state/lib/api.ts
index f17d0337c..2b9412f3d 100644
--- a/src/state/lib/api.ts
+++ b/src/state/lib/api.ts
@@ -21,7 +21,7 @@ export function doPolyfill() {
 export async function post(
   store: RootStoreModel,
   text: string,
-  replyTo?: Post.PostRef,
+  replyTo?: Post.ReplyRef,
   knownHandles?: Set<string>,
 ) {
   let reply
@@ -43,6 +43,14 @@ export async function post(
     }
   }
   const entities = extractEntities(text, knownHandles)
+  if (entities) {
+    for (const ent of entities) {
+      if (ent.type === 'mention') {
+        const prof = await store.profiles.getProfile(ent.value)
+        ent.value = prof.data.did
+      }
+    }
+  }
   return await store.api.app.bsky.feed.post.create(
     {did: store.me.did || ''},
     {