1
0
This commit is contained in:
MeiMei
2019-09-09 22:46:45 +09:00
committed by syuilo
parent 9b91b92bca
commit 827c378ac1
6 changed files with 100 additions and 60 deletions
+13 -3
View File
@@ -1,13 +1,23 @@
import Resolver from '../../resolver';
import { IRemoteUser } from '../../../../models/entities/user';
import { createNote, fetchNote } from '../../models/note';
import { getApId } from '../../type';
import { getApLock } from '../../../../misc/app-lock';
/**
* 投稿作成アクティビティを捌きます
*/
export default async function(resolver: Resolver, actor: IRemoteUser, note: any, silent = false): Promise<void> {
const exist = await fetchNote(note);
if (exist == null) {
await createNote(note);
const uri = getApId(note);
const unlock = await getApLock(uri);
try {
const exist = await fetchNote(note);
if (exist == null) {
await createNote(note);
}
} finally {
unlock();
}
}