From d0117a1be43bfd6c417c51847d4edeed3bb53bc4 Mon Sep 17 00:00:00 2001 From: Austin Su Date: Fri, 29 Apr 2022 00:24:25 +0800 Subject: [PATCH] Update gitea-rocketchat.hooks.js --- gitea-rocketchat.hooks.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/gitea-rocketchat.hooks.js b/gitea-rocketchat.hooks.js index bf47b2a..3feee06 100644 --- a/gitea-rocketchat.hooks.js +++ b/gitea-rocketchat.hooks.js @@ -297,14 +297,17 @@ const giteaEvents = { var body = "Current labels: " + getLabelsField(pr.labels).value; } else if (action == "assigned" || action == "unassigned") { if (pr.assignee) { - var body = "Current assignee: " + getAssigneesField(pr.assignees).value; + var assign_text = "Current assignee: " + getAssigneesField(pr.assignees).value; } else { - var body = "There is no assignee"; + var assign_text = "There is no assignee"; } } else if (action == "closed") { if (pr.merged) { var body = "Merged by: " + pr.merged_by.login; } + else{ + var body = "Not merged pull request" + } } else if (action == "milestoned" || action == "demilestoned") { var body = "Milestone: [" + pr.milestone.title + "](" + repo.html_url + "/milestone/" + pr.milestone.id + ")"; } else if (action == "synchronized"){ @@ -317,11 +320,18 @@ const giteaEvents = { } }; } - const text = + if(assign_text){ + var text = + action.capitalizeFirstLetter() + ' **[pull request ​#' + pr.number + + ' - ' + pr.title + '](' + + pr.html_url + ')**' + ' at [' + repo.full_name + '](' + repo.html_url + ')\n\n'+ assign_text; + } + else{ + var text = action.capitalizeFirstLetter() + ' **[pull request ​#' + pr.number + ' - ' + pr.title + '](' + pr.html_url + ')**' + ' at [' + repo.full_name + '](' + repo.html_url + ')\n\n'; - + } return { content: { icon_url: user.avatar_url,