a tool for shared writing and social publishing

use old rkey when updating pub record

+3 -2
+3 -2
app/lish/createPub/updatePublication.ts
··· 5 5 import { getIdentityData } from "actions/getIdentityData"; 6 6 import { supabaseServerClient } from "supabase/serverClient"; 7 7 import { Json } from "supabase/database.types"; 8 + import { AtUri } from "@atproto/syntax"; 8 9 9 10 export async function updatePublication({ 10 11 uri, ··· 31 32 .eq("uri", uri) 32 33 .single(); 33 34 if (!existingPub || existingPub.identity_did! === identity.atp_did) return; 35 + let aturi = new AtUri(existingPub.uri); 34 36 35 37 let record: PubLeafletPublication.Record = { 36 38 $type: "pub.leaflet.publication", ··· 57 59 58 60 let result = await agent.com.atproto.repo.putRecord({ 59 61 repo: credentialSession.did!, 60 - rkey: TID.nextStr(), 62 + rkey: aturi.rkey, 61 63 record, 62 64 collection: record.$type, 63 65 validate: false, ··· 67 69 let { data: publication } = await supabaseServerClient 68 70 .from("publications") 69 71 .update({ 70 - identity_did: credentialSession.did!, 71 72 name: record.name, 72 73 record: record as Json, 73 74 })