Update gitea-rocketchat.hooks.js

This commit is contained in:
Austin Su 2022-04-29 00:24:25 +08:00 committed by GitHub
parent 8c568c473d
commit d0117a1be4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,