a tool for shared writing and social publishing

delete entiteis before publishing

+9 -9
+9 -9
actions/publishToPublication.ts
··· 103 103 existingDocUri = draft?.document; 104 104 } 105 105 106 + // Heuristic: Remove title entities if this is the first time publishing 107 + // (when coming from a standalone leaflet with entitiesToDelete passed in) 108 + if (entitiesToDelete && entitiesToDelete.length > 0 && !existingDocUri) { 109 + await supabaseServerClient 110 + .from("entities") 111 + .delete() 112 + .in("id", entitiesToDelete); 113 + } 114 + 106 115 let { data } = await supabaseServerClient.rpc("get_facts", { 107 116 root: root_entity, 108 117 }); ··· 187 196 .eq("leaflet", leaflet_id) 188 197 .eq("publication", publication_uri), 189 198 ]); 190 - 191 - // Heuristic: Remove title entities if this is the first time publishing 192 - // (when coming from a standalone leaflet with entitiesToDelete passed in) 193 - if (entitiesToDelete && entitiesToDelete.length > 0 && !existingDocUri) { 194 - await supabaseServerClient 195 - .from("entities") 196 - .delete() 197 - .in("id", entitiesToDelete); 198 - } 199 199 } else { 200 200 // Publishing standalone - update leaflets_to_documents 201 201 await supabaseServerClient.from("leaflets_to_documents").upsert({