diff options
Diffstat (limited to 'src/remote/activitypub/kernel/undo/like.ts')
| -rw-r--r-- | src/remote/activitypub/kernel/undo/like.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/remote/activitypub/kernel/undo/like.ts b/src/remote/activitypub/kernel/undo/like.ts index b324ec854c..2678828a9a 100644 --- a/src/remote/activitypub/kernel/undo/like.ts +++ b/src/remote/activitypub/kernel/undo/like.ts @@ -1,20 +1,20 @@ -import * as mongo from 'mongodb'; -import { IRemoteUser } from '../../../../models/user'; +import { IRemoteUser } from '../../../../models/entities/user'; import { ILike } from '../../type'; -import Note from '../../../../models/note'; import deleteReaction from '../../../../services/note/reaction/delete'; +import { Notes } from '../../../../models'; /** * Process Undo.Like activity */ export default async (actor: IRemoteUser, activity: ILike): Promise<void> => { const id = typeof activity.object == 'string' ? activity.object : activity.object.id; + if (id == null) throw new Error('missing id'); - const noteId = new mongo.ObjectID(id.split('/').pop()); + const noteId = id.split('/').pop(); - const note = await Note.findOne({ _id: noteId }); - if (note === null) { - throw 'note not found'; + const note = await Notes.findOne(noteId); + if (note == null) { + throw new Error('note not found'); } await deleteReaction(actor, note); |