From 02f6ef9481fe592736bc18a196bfd0a1b76c42d7 Mon Sep 17 00:00:00 2001 From: okseby Date: Tue, 29 Aug 2023 09:20:15 -0400 Subject: [PATCH] Code cleanup --- bot/utils.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bot/utils.go b/bot/utils.go index 088acc3..6eb3846 100644 --- a/bot/utils.go +++ b/bot/utils.go @@ -136,11 +136,13 @@ func processIssueCommentEvent(event *github.IssueCommentEvent) { // Check if there are thumbs up (:+1:) reactions for _, comment := range comments { - if strings.Contains(comment.GetBody(), "+1") && !strings.Contains(comment.GetUser().GetLogin(), "bot") { + commentAuthor := comment.GetUser().GetLogin() + + if strings.Contains(comment.GetBody(), "+1") && !strings.Contains(commentAuthor, "bot") { value, exists := approvals[prNumber] - if !(exists && strings.Contains(value, comment.GetUser().GetLogin())) { + if !(exists && strings.Contains(value, commentAuthor)) { reactionCount++ - approvals[prNumber] = comment.GetUser().GetLogin() + approvals[prNumber] = commentAuthor } else { // Respond with a comment comment := &github.IssueComment{