From c1e791bad0b079af67398f6407221e6dcbb573dd Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Wed, 25 Jul 2018 22:01:25 +0200 Subject: expliciting type checks and predicates (server only) --- server/lib/video-comment.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'server/lib/video-comment.ts') diff --git a/server/lib/video-comment.ts b/server/lib/video-comment.ts index f88e5cfdf..70ba7c303 100644 --- a/server/lib/video-comment.ts +++ b/server/lib/video-comment.ts @@ -9,14 +9,14 @@ import { sendCreateVideoComment } from './activitypub/send' async function createVideoComment (obj: { text: string, - inReplyToComment: VideoCommentModel, + inReplyToComment: VideoCommentModel | null, video: VideoModel account: AccountModel }, t: Sequelize.Transaction) { - let originCommentId: number = null - let inReplyToCommentId: number = null + let originCommentId: number | null = null + let inReplyToCommentId: number | null = null - if (obj.inReplyToComment) { + if (obj.inReplyToComment && obj.inReplyToComment !== null) { originCommentId = obj.inReplyToComment.originCommentId || obj.inReplyToComment.id inReplyToCommentId = obj.inReplyToComment.id } -- cgit v1.2.3