Fix bug
This commit is contained in:
parent
de620c822a
commit
a0c6e7af1c
|
@ -18,13 +18,13 @@ export default async (actor, activity): Promise<void> => {
|
||||||
|
|
||||||
switch (object.type) {
|
switch (object.type) {
|
||||||
case 'Note':
|
case 'Note':
|
||||||
deleteNote(uri);
|
deleteNote(actor, uri);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Tombstone':
|
case 'Tombstone':
|
||||||
const post = await Post.findOne({ uri });
|
const post = await Post.findOne({ uri });
|
||||||
if (post != null) {
|
if (post != null) {
|
||||||
deleteNote(uri);
|
deleteNote(actor, uri);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,20 @@ import { createDb } from '../../../../queue';
|
||||||
|
|
||||||
const log = debug('misskey:activitypub');
|
const log = debug('misskey:activitypub');
|
||||||
|
|
||||||
export default async function(uri: string) {
|
export default async function(actor, uri: string) {
|
||||||
log(`Deleting the Note: ${uri}`);
|
log(`Deleting the Note: ${uri}`);
|
||||||
|
|
||||||
const post = await Post.findOneAndDelete({ uri });
|
const post = await Post.findOne({ uri });
|
||||||
|
|
||||||
|
if (post == null) {
|
||||||
|
throw new Error('post not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (post.userId !== actor._id) {
|
||||||
|
throw new Error('投稿を削除しようとしているユーザーは投稿の作成者ではありません');
|
||||||
|
}
|
||||||
|
|
||||||
|
Post.remove({ _id: post._id });
|
||||||
|
|
||||||
createDb({
|
createDb({
|
||||||
type: 'deletePostDependents',
|
type: 'deletePostDependents',
|
||||||
|
|
Loading…
Reference in New Issue