diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-10-11 02:11:12 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-10-11 02:11:12 +0900 |
| commit | 7dae5107f8fd8d3389b304b22256436ee1371902 (patch) | |
| tree | de33cdeb784121ecd47dcb4fe2ae9436cad28c40 /src/models/note.ts | |
| parent | Update stream.ts (diff) | |
| download | misskey-7dae5107f8fd8d3389b304b22256436ee1371902.tar.gz misskey-7dae5107f8fd8d3389b304b22256436ee1371902.tar.bz2 misskey-7dae5107f8fd8d3389b304b22256436ee1371902.zip | |
Improve fault tolerance
Diffstat (limited to 'src/models/note.ts')
| -rw-r--r-- | src/models/note.ts | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/models/note.ts b/src/models/note.ts index 6c16ab054b..a27c92c572 100644 --- a/src/models/note.ts +++ b/src/models/note.ts @@ -380,12 +380,23 @@ export const pack = async ( // resolve promises in _note object _note = await rap(_note); - // (データベースの欠損などで)ユーザーがデータベース上に見つからなかったとき + //#region (データベースの欠損などで)参照しているデータがデータベース上に見つからなかったとき if (_note.user == null) { - console.warn(`in packaging note: note user not found on database: note(${_note.id})`); + console.warn(`[DAMAGED DB] (missing) in pkg note -> user :: ${_note.id} (user ${_note.userId})`); return null; } + if (_note.replyId != null && _note.reply == null) { + console.warn(`[DAMAGED DB] (missing) in pkg note -> reply :: ${_note.id} (reply ${_note.replyId})`); + return null; + } + + if (_note.renoteId != null && _note.renote == null) { + console.warn(`[DAMAGED DB] (missing) in pkg note -> renote :: ${_note.id} (renote ${_note.renoteId})`); + return null; + } + //#endregion + if (_note.user.isCat && _note.text) { _note.text = _note.text.replace(/な/g, 'にゃ').replace(/ナ/g, 'ニャ').replace(/ナ/g, 'ニャ'); } |