Fix not accepting deletes

This commit is contained in:
Shadowfacts 2019-08-18 17:15:39 -04:00
parent 5be69ec556
commit aea8a2d826
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 3 additions and 3 deletions

View File

@ -90,11 +90,11 @@ function sanitizeStatus(content: string): string {
async function handleCreateNote(create: CreateActivity, req: Request, res: Response) {
const noteObject = create.object as NoteObject;
getActor(noteObject.attributedTo); // get and cache the actor if it's not already cached
const actor = await getActor(noteObject.attributedTo); // get and cache the actor if it's not already cached
const sanitizedContent = sanitizeStatus(noteObject.content);
const note = new Note();
note.id = noteObject.id;
note.actor = await getConnection().getRepository(Actor).findOne(noteObject.attributedTo);
note.actor = await getConnection().getRepository(Actor).findOne(actor.id);
note.content = sanitizedContent;
note.attributedTo = noteObject.attributedTo;
note.inReplyTo = noteObject.inReplyTo;
@ -115,7 +115,7 @@ async function handleDelete(activity: Activity, req: Request, res: Response) {
.delete()
.from(Note, "note")
.where("note.id = :id", { id: deleteActivity.object })
.andWhere("note.actor = :actor", { actor: deleteActivity.actor })
.andWhere("note.\"actorId\" = :actor", { actor: deleteActivity.actor })
.execute();
} catch (err) {
console.error(`Encountered error deleting ${deleteActivity.object}`, err);