tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
288
fork
atom
a tool for shared writing and social publishing
288
fork
atom
overview
issues
27
pulls
pipelines
fix publish to publication from leaflet
awarm.space
3 months ago
e505653e
d55da6f0
+9
-7
1 changed file
expand all
collapse all
unified
split
actions
publishToPublication.ts
+9
-7
actions/publishToPublication.ts
···
81
81
82
82
if (publication_uri) {
83
83
// Publishing to a publication - use leaflets_in_publications
84
84
-
let { data } = await supabaseServerClient
85
85
-
.from("leaflets_in_publications")
86
86
-
.select("*, publications(*), documents(*)")
87
87
-
.eq("publication", publication_uri)
88
88
-
.eq("leaflet", leaflet_id)
84
84
+
let { data, error } = await supabaseServerClient
85
85
+
.from("publications")
86
86
+
.select("*, leaflets_in_publications(*, documents(*))")
87
87
+
.eq("uri", publication_uri)
88
88
+
.eq("leaflets_in_publications.leaflet", leaflet_id)
89
89
.single();
90
90
-
if (!data || identity.atp_did !== data?.publications?.identity_did)
90
90
+
console.log(error);
91
91
+
92
92
+
if (!data || identity.atp_did !== data?.identity_did)
91
93
throw new Error("No draft or not publisher");
92
92
-
draft = data;
94
94
+
draft = data.leaflets_in_publications[0];
93
95
existingDocUri = draft?.doc;
94
96
} else {
95
97
// Publishing standalone - use leaflets_to_documents