a tool for shared writing and social publishing

fix bsky post indexing function

+12 -3
+12 -3
app/api/inngest/functions/index_post_mention.ts
··· 3 3 import { AtpAgent, AtUri } from "@atproto/api"; 4 4 import { Json } from "supabase/database.types"; 5 5 import { ids } from "lexicons/api/lexicons"; 6 - import { Notification, pingIdentityToUpdateNotification } from "src/notifications"; 6 + import { 7 + Notification, 8 + pingIdentityToUpdateNotification, 9 + } from "src/notifications"; 7 10 import { v7 } from "uuid"; 8 11 import { idResolver } from "app/(home-pages)/reader/idResolver"; 9 12 import { documentUriFilter } from "src/utils/uriHelpers"; ··· 60 63 let { data: pub, error } = await supabaseServerClient 61 64 .from("publications") 62 65 .select("*") 63 - .or(`record->>base_path.eq.${url.host},record->>url.eq.https://${url.host}`) 66 + .or( 67 + `record->>base_path.eq.${url.host},record->>url.eq.https://${url.host}`, 68 + ) 69 + .order("uri", { ascending: false }) 70 + .limit(1) 64 71 .single(); 65 72 66 73 if (!pub) { ··· 80 87 const docData = docDataArr?.[0]; 81 88 82 89 if (!docData) { 83 - return { message: `No document found for publication ${url.host}/${path[0]}` }; 90 + return { 91 + message: `No document found for publication ${url.host}/${path[0]}`, 92 + }; 84 93 } 85 94 86 95 documentUri = docData.uri;