forked from shadowfacts/shadowfacts.net
Fix crash when trying to comment
This commit is contained in:
parent
08b936980f
commit
b44a37de5a
|
@ -38,7 +38,7 @@ export async function getActor(url: string, db: Database, forceUpdate: boolean =
|
||||||
return remote;
|
return remote;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getCachedActor(url: string, db: Database): Promise<Actor> {
|
export async function getCachedActor(url: string, db: Database): Promise<Actor | null> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
db.get("SELECT * FROM actors WHERE id = $id", {
|
db.get("SELECT * FROM actors WHERE id = $id", {
|
||||||
$id: url
|
$id: url
|
||||||
|
@ -46,15 +46,19 @@ export async function getCachedActor(url: string, db: Database): Promise<Actor>
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
} else {
|
} else {
|
||||||
resolve({
|
if (result) {
|
||||||
id: result.id,
|
resolve({
|
||||||
name: result.display_name,
|
id: result.id,
|
||||||
inbox: result.inbox,
|
name: result.display_name,
|
||||||
icon: result.icon_url,
|
inbox: result.inbox,
|
||||||
publicKey: {
|
icon: result.icon_url,
|
||||||
publicKeyPem: result.public_key_pem
|
publicKey: {
|
||||||
}
|
publicKeyPem: result.public_key_pem
|
||||||
} as Actor);
|
}
|
||||||
|
} as Actor);
|
||||||
|
} else {
|
||||||
|
resolve(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue