From 8cb9852058e36cddafb6eb63f621468a855c83b8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 13 Apr 2019 18:45:07 +0900 Subject: リプライ先をエラー時に無視すると本来は投票なのに投票じゃないと扱われおかしくなるのでエラーにするように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/remote/activitypub/models/note.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/remote/activitypub/models/note.ts b/src/remote/activitypub/models/note.ts index 60d4cf37d7..9ed2fd641c 100644 --- a/src/remote/activitypub/models/note.ts +++ b/src/remote/activitypub/models/note.ts @@ -120,13 +120,15 @@ export async function createNote(value: any, resolver?: Resolver, silent = false : []; // リプライ - const reply: Note | undefined | null = note.inReplyTo - ? await resolveNote(note.inReplyTo, resolver).catch(e => { - // 4xxの場合はリプライしてないことにする - if (e.statusCode >= 400 && e.statusCode < 500) { - logger.warn(`Ignored inReplyTo ${note.inReplyTo} - ${e.statusCode} `); - return null; + const reply: Note | null = note.inReplyTo + ? await resolveNote(note.inReplyTo, resolver).then(x => { + if (x == null) { + logger.warn(`Specified inReplyTo, but nout found`); + throw 'inReplyTo not found'; + } else { + return x; } + }).catch(e => { logger.warn(`Error in inReplyTo ${note.inReplyTo} - ${e.statusCode || e}`); throw e; }) -- cgit v1.2.3-freya