kopia lustrzana https://github.com/cloudflare/wildebeest
fix properties parsing with Neon
rodzic
777c4bc60f
commit
8508fd1fa6
|
@ -225,7 +225,15 @@ export async function getNotifications(db: Database, actor: Actor, domain: strin
|
||||||
|
|
||||||
for (let i = 0, len = results.length; i < len; i++) {
|
for (let i = 0, len = results.length; i < len; i++) {
|
||||||
const result = results[i]
|
const result = results[i]
|
||||||
const properties = JSON.parse(result.properties)
|
let properties
|
||||||
|
if (typeof result.properties === 'object') {
|
||||||
|
// neon uses JSONB for properties which is returned as a deserialized
|
||||||
|
// object.
|
||||||
|
properties = result.properties
|
||||||
|
} else {
|
||||||
|
// D1 uses a string for JSON properties
|
||||||
|
properties = JSON.parse(result.properties)
|
||||||
|
}
|
||||||
const notifFromActorId = new URL(result.notif_from_actor_id)
|
const notifFromActorId = new URL(result.notif_from_actor_id)
|
||||||
|
|
||||||
const notifFromActor = await getActorById(db, notifFromActorId)
|
const notifFromActor = await getActorById(db, notifFromActorId)
|
||||||
|
|
|
@ -105,7 +105,15 @@ export async function toMastodonStatusFromRow(domain: string, db: Database, row:
|
||||||
console.warn('missing `row.publisher_actor_id`')
|
console.warn('missing `row.publisher_actor_id`')
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
const properties = JSON.parse(row.properties)
|
let properties
|
||||||
|
if (typeof row.properties === 'object') {
|
||||||
|
// neon uses JSONB for properties which is returned as a deserialized
|
||||||
|
// object.
|
||||||
|
properties = row.properties
|
||||||
|
} else {
|
||||||
|
// D1 uses a string for JSON properties
|
||||||
|
properties = JSON.parse(row.properties)
|
||||||
|
}
|
||||||
const actorId = new URL(row.publisher_actor_id)
|
const actorId = new URL(row.publisher_actor_id)
|
||||||
|
|
||||||
const author = actors.personFromRow({
|
const author = actors.personFromRow({
|
||||||
|
|
Ładowanie…
Reference in New Issue