about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2025-03-03 23:41:13 +0000
committerGitHub <noreply@github.com>2025-03-03 15:41:13 -0800
commit7222d6fe520cfdd811b5457cf9c8f9d2524197a0 (patch)
treec8de973c56cacc2d2af1484cdcf8cb95e8d41098
parent8b6dde17fdda9198905279ee3b6a1dd6b1b800a6 (diff)
downloadvoidsky-7222d6fe520cfdd811b5457cf9c8f9d2524197a0.tar.zst
init log using `getLog` (#7886)
-rw-r--r--src/state/messages/events/agent.ts17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/state/messages/events/agent.ts b/src/state/messages/events/agent.ts
index 9890eee3f..285de7025 100644
--- a/src/state/messages/events/agent.ts
+++ b/src/state/messages/events/agent.ts
@@ -235,20 +235,21 @@ export class MessagesEventBus {
 
     try {
       const response = await networkRetry(2, () => {
-        return this.agent.api.chat.bsky.convo.listConvos(
-          {
-            limit: 1,
-          },
+        return this.agent.chat.bsky.convo.getLog(
+          {},
           {headers: DM_SERVICE_HEADERS},
         )
       })
       // throw new Error('UNCOMMENT TO TEST INIT FAILURE')
 
-      const {convos} = response.data
+      const {cursor} = response.data
 
-      for (const convo of convos) {
-        if (convo.rev > (this.latestRev = this.latestRev || convo.rev)) {
-          this.latestRev = convo.rev
+      // should always be defined
+      if (cursor) {
+        if (!this.latestRev) {
+          this.latestRev = cursor
+        } else if (cursor > this.latestRev) {
+          this.latestRev = cursor
         }
       }