From 5283b47611f437a34abe3f4eea2163ac82886fb9 Mon Sep 17 00:00:00 2001 From: Muunatic Date: Thu, 28 Dec 2023 18:32:15 +0700 Subject: [PATCH] refactor: using curly bracket on conditional --- src/class/issuesOpen.ts | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/class/issuesOpen.ts b/src/class/issuesOpen.ts index e63c425..2ea6046 100644 --- a/src/class/issuesOpen.ts +++ b/src/class/issuesOpen.ts @@ -27,16 +27,20 @@ export default class IssuesOpen { * @returns {Promise} */ public async open(): Promise { - if (this.context.payload.sender.login === "Muunatic") return; - const issueComment = this.context.issue({ - body: `Hello @${this.context.payload.sender.login} Thank you for submitting Issue, please wait for next notification after we review your Issue.` - }); - console.log("Issues created"); - await this.context.octokit.issues.addLabels( - this.context.issue({ - labels: ["Pending"] - }) - ); - await this.context.octokit.issues.createComment(issueComment); + if (this.context.payload.sender.login !== "Muunatic") { + const issueComment = this.context.issue({ + body: `Hello @${this.context.payload.sender.login} Thank you for submitting Issue, please wait for next notification after we review your Issue.` + }); + console.log("Issues created"); + await this.context.octokit.issues.addLabels( + this.context.issue({ + labels: ["Pending"] + }) + ); + await this.context.octokit.issues.createComment(issueComment); + } else { + return; + } } + }