From 5d0057db11557b907fb56d9270367b308de4a764 Mon Sep 17 00:00:00 2001 From: Layton Whiteley Date: Thu, 21 Oct 2021 15:15:54 +0200 Subject: [PATCH] chore: fix undefined ref --- src/helpers.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/helpers.js b/src/helpers.js index 13fb3b6e..d22dc132 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -33,7 +33,7 @@ const getUsernames = ({ payload }) => { return users; }; -const buildTag = ({ issueNumber, status, title, url }) => { +const buildTag = ({ issueNumber, status, title, url } = {}) => { return [SEARCH_PREFIX, issueNumber, status, `<${url}|${title}>`].join(DELIM); }; @@ -252,8 +252,9 @@ const getWatchers = (match) => { if (match && Array.isArray(match.attachments)) { const { fields } = - match.attachments.find(({ title }) => title.includes(WATCHERS_TITLE)) || - {}; + match.attachments.filter(Boolean).find((data = {}) => { + return get(data, 'title').includes(WATCHERS_TITLE); + }) || {}; if (fields) { watchers = `\n${fields[0].value}`; }