forked from shadowfacts/shadowfacts.net
Fix not accepting deletes
This commit is contained in:
parent
5be69ec556
commit
aea8a2d826
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue