From 135d5a51d2c11c81b6b4631a87b91c7f97ff5548 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Sun, 25 Apr 2021 18:29:43 +0100 Subject: [PATCH] Handle no body --- src/NotificationsProcessor.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/NotificationsProcessor.ts b/src/NotificationsProcessor.ts index 24bfbc65..b1ca08ad 100644 --- a/src/NotificationsProcessor.ts +++ b/src/NotificationsProcessor.ts @@ -60,7 +60,7 @@ export class NotificationProcessor { if (diff) { plain += "\n\n "; if (diff.merged) { - plain += `\n\n PR was merged by ${diff.mergedBy ? NotificationProcessor.formatUser(diff.mergedBy) : ""}`; + plain += `\n\n PR was merged by ${diff.mergedBy ? NotificationProcessor.formatUser(diff.mergedBy) : ""}`; } else if (diff.state) { const state = diff.state[0].toUpperCase() + diff.state.slice(1).toLowerCase(); plain += `\n\n State changed to: ${state}`; @@ -75,7 +75,11 @@ export class NotificationProcessor { if (newComment) { const comment = notif.subject.latest_comment_url_data as IssuesGetCommentResponseData; const user = comment.user ? NotificationProcessor.formatUser(comment.user) : 'user'; - plain += `\n\n ${user}:\n\n > ${comment.body}`; + if (comment.body) { + plain += `\n\n ${user}:\n\n > ${comment.body}`; + } else { + plain += `\n\n ${user}:\n\n posted with no body`; + } } return { plain,