This commit is contained in:
syuilo 2018-04-07 06:59:20 +09:00
parent a34710fea9
commit 8273a7e748

View file

@ -2,10 +2,11 @@ import * as debug from 'debug';
import Post from '../../../../models/post'; import Post from '../../../../models/post';
import { createDb } from '../../../../queue'; import { createDb } from '../../../../queue';
import { IRemoteUser } from '../../../../models/user';
const log = debug('misskey:activitypub'); const log = debug('misskey:activitypub');
export default async function(actor, uri: string) { export default async function(actor: IRemoteUser, uri: string): Promise<void> {
log(`Deleting the Note: ${uri}`); log(`Deleting the Note: ${uri}`);
const post = await Post.findOne({ uri }); const post = await Post.findOne({ uri });
@ -14,7 +15,7 @@ export default async function(actor, uri: string) {
throw new Error('post not found'); throw new Error('post not found');
} }
if (post.userId !== actor._id) { if (!post.userId.equals(actor._id)) {
throw new Error('投稿を削除しようとしているユーザーは投稿の作成者ではありません'); throw new Error('投稿を削除しようとしているユーザーは投稿の作成者ではありません');
} }