blob: 8e9447b481215d22c6672878658f1d1bb2d7a8d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import * as debug from 'debug';
import Post from '../../../../models/post';
import { IRemoteUser } from '../../../../models/user';
const log = debug('misskey:activitypub');
export default async function(actor: IRemoteUser, uri: string): Promise<void> {
log(`Deleting the Note: ${uri}`);
const post = await Post.findOne({ uri });
if (post == null) {
throw new Error('post not found');
}
if (!post.userId.equals(actor._id)) {
throw new Error('投稿を削除しようとしているユーザーは投稿の作成者ではありません');
}
Post.update({ _id: post._id }, {
$set: {
deletedAt: new Date(),
text: null,
textHtml: null,
mediaIds: [],
poll: null
}
});
}
|