mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-26 22:29:28 +09:00
Fix bug
This commit is contained in:
parent
765a10c8da
commit
de620c822a
@ -1,18 +1,35 @@
|
|||||||
import Resolver from '../../resolver';
|
import Resolver from '../../resolver';
|
||||||
import deleteNote from './note';
|
import deleteNote from './note';
|
||||||
|
import Post from '../../../../models/post';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 削除アクティビティを捌きます
|
||||||
|
*/
|
||||||
export default async (actor, activity): Promise<void> => {
|
export default async (actor, activity): Promise<void> => {
|
||||||
if ('actor' in activity && actor.account.uri !== activity.actor) {
|
if ('actor' in activity && actor.account.uri !== activity.actor) {
|
||||||
throw new Error();
|
throw new Error('invalid actor');
|
||||||
}
|
}
|
||||||
|
|
||||||
const resolver = new Resolver();
|
const resolver = new Resolver();
|
||||||
|
|
||||||
const object = await resolver.resolve(activity);
|
const object = await resolver.resolve(activity.object);
|
||||||
|
|
||||||
|
const uri = (object as any).id;
|
||||||
|
|
||||||
switch (object.type) {
|
switch (object.type) {
|
||||||
case 'Note':
|
case 'Note':
|
||||||
deleteNote(object);
|
deleteNote(uri);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Tombstone':
|
||||||
|
const post = await Post.findOne({ uri });
|
||||||
|
if (post != null) {
|
||||||
|
deleteNote(uri);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
console.warn(`Unknown type: ${object.type}`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
|
import * as debug from 'debug';
|
||||||
|
|
||||||
import Post from '../../../../models/post';
|
import Post from '../../../../models/post';
|
||||||
import { createDb } from '../../../../queue';
|
import { createDb } from '../../../../queue';
|
||||||
|
|
||||||
export default async function(note) {
|
const log = debug('misskey:activitypub');
|
||||||
const post = await Post.findOneAndDelete({ uri: note.id });
|
|
||||||
|
export default async function(uri: string) {
|
||||||
|
log(`Deleting the Note: ${uri}`);
|
||||||
|
|
||||||
|
const post = await Post.findOneAndDelete({ uri });
|
||||||
|
|
||||||
createDb({
|
createDb({
|
||||||
type: 'deletePostDependents',
|
type: 'deletePostDependents',
|
||||||
|
Loading…
Reference in New Issue
Block a user