summaryrefslogtreecommitdiffstats
path: root/modules/webhook
diff options
context:
space:
mode:
authorJohn Olheiser <42128690+jolheiser@users.noreply.github.com>2019-12-16 18:28:19 -0600
committerLunny Xiao <xiaolunwen@gmail.com>2019-12-17 08:28:19 +0800
commit1707f59966df7fa4375235dbf43326d382eeaf97 (patch)
tree425a66eebe2d947e89584de9aab5ddada5959d21 /modules/webhook
parent33662399d59a94436e6acb5e5bf41935dbc75328 (diff)
downloadgitea-1707f59966df7fa4375235dbf43326d382eeaf97.tar.gz
gitea-1707f59966df7fa4375235dbf43326d382eeaf97.zip
Remove text from action-only webhooks (#9377)
* Remove text from contextual webhooks Signed-off-by: jolheiser <john.olheiser@gmail.com> * Missed one in Telegram Signed-off-by: jolheiser <john.olheiser@gmail.com>
Diffstat (limited to 'modules/webhook')
-rw-r--r--modules/webhook/dingtalk.go18
-rw-r--r--modules/webhook/discord.go18
-rw-r--r--modules/webhook/msteams.go18
-rw-r--r--modules/webhook/telegram.go18
4 files changed, 0 insertions, 72 deletions
diff --git a/modules/webhook/dingtalk.go b/modules/webhook/dingtalk.go
index b6d58f55cf..5ec8db9649 100644
--- a/modules/webhook/dingtalk.go
+++ b/modules/webhook/dingtalk.go
@@ -139,35 +139,26 @@ func getDingtalkIssuesPayload(p *api.IssuePayload) (*DingtalkPayload, error) {
text = p.Issue.Body
case api.HookIssueClosed:
title = fmt.Sprintf("[%s] Issue closed: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
case api.HookIssueReOpened:
title = fmt.Sprintf("[%s] Issue re-opened: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
case api.HookIssueEdited:
title = fmt.Sprintf("[%s] Issue edited: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
text = p.Issue.Body
case api.HookIssueAssigned:
title = fmt.Sprintf("[%s] Issue assigned to %s: #%d %s", p.Repository.FullName,
p.Issue.Assignee.UserName, p.Index, p.Issue.Title)
- text = p.Issue.Body
case api.HookIssueUnassigned:
title = fmt.Sprintf("[%s] Issue unassigned: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
case api.HookIssueLabelUpdated:
title = fmt.Sprintf("[%s] Issue labels updated: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
case api.HookIssueLabelCleared:
title = fmt.Sprintf("[%s] Issue labels cleared: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
case api.HookIssueSynchronized:
title = fmt.Sprintf("[%s] Issue synchronized: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
case api.HookIssueMilestoned:
title = fmt.Sprintf("[%s] Issue milestone: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
case api.HookIssueDemilestoned:
title = fmt.Sprintf("[%s] Issue clear milestone: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
}
return &DingtalkPayload{
@@ -238,10 +229,8 @@ func getDingtalkPullRequestPayload(p *api.PullRequestPayload) (*DingtalkPayload,
} else {
title = fmt.Sprintf("[%s] Pull request closed: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
}
- text = p.PullRequest.Body
case api.HookIssueReOpened:
title = fmt.Sprintf("[%s] Pull request re-opened: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
case api.HookIssueEdited:
title = fmt.Sprintf("[%s] Pull request edited: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
text = p.PullRequest.Body
@@ -253,25 +242,18 @@ func getDingtalkPullRequestPayload(p *api.PullRequestPayload) (*DingtalkPayload,
title = fmt.Sprintf("[%s] Pull request assigned to %s: #%d %s", p.Repository.FullName,
strings.Join(list, ", "),
p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
case api.HookIssueUnassigned:
title = fmt.Sprintf("[%s] Pull request unassigned: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
case api.HookIssueLabelUpdated:
title = fmt.Sprintf("[%s] Pull request labels updated: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
case api.HookIssueLabelCleared:
title = fmt.Sprintf("[%s] Pull request labels cleared: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
case api.HookIssueSynchronized:
title = fmt.Sprintf("[%s] Pull request synchronized: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
case api.HookIssueMilestoned:
title = fmt.Sprintf("[%s] Pull request milestone: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
case api.HookIssueDemilestoned:
title = fmt.Sprintf("[%s] Pull request clear milestone: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
}
return &DingtalkPayload{
diff --git a/modules/webhook/discord.go b/modules/webhook/discord.go
index f92157a1ab..99444851bc 100644
--- a/modules/webhook/discord.go
+++ b/modules/webhook/discord.go
@@ -238,10 +238,8 @@ func getDiscordIssuesPayload(p *api.IssuePayload, meta *DiscordMeta) (*DiscordPa
case api.HookIssueClosed:
title = fmt.Sprintf("[%s] Issue closed: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
color = redColor
- text = p.Issue.Body
case api.HookIssueReOpened:
title = fmt.Sprintf("[%s] Issue re-opened: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
color = yellowColor
case api.HookIssueEdited:
title = fmt.Sprintf("[%s] Issue edited: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
@@ -250,31 +248,24 @@ func getDiscordIssuesPayload(p *api.IssuePayload, meta *DiscordMeta) (*DiscordPa
case api.HookIssueAssigned:
title = fmt.Sprintf("[%s] Issue assigned to %s: #%d %s", p.Repository.FullName,
p.Issue.Assignee.UserName, p.Index, p.Issue.Title)
- text = p.Issue.Body
color = greenColor
case api.HookIssueUnassigned:
title = fmt.Sprintf("[%s] Issue unassigned: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
color = yellowColor
case api.HookIssueLabelUpdated:
title = fmt.Sprintf("[%s] Issue labels updated: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
color = yellowColor
case api.HookIssueLabelCleared:
title = fmt.Sprintf("[%s] Issue labels cleared: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
color = yellowColor
case api.HookIssueSynchronized:
title = fmt.Sprintf("[%s] Issue synchronized: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
color = yellowColor
case api.HookIssueMilestoned:
title = fmt.Sprintf("[%s] Issue milestone: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
color = yellowColor
case api.HookIssueDemilestoned:
title = fmt.Sprintf("[%s] Issue clear milestone: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
color = yellowColor
}
@@ -368,10 +359,8 @@ func getDiscordPullRequestPayload(p *api.PullRequestPayload, meta *DiscordMeta)
title = fmt.Sprintf("[%s] Pull request closed: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
color = redColor
}
- text = p.PullRequest.Body
case api.HookIssueReOpened:
title = fmt.Sprintf("[%s] Pull request re-opened: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
color = yellowColor
case api.HookIssueEdited:
title = fmt.Sprintf("[%s] Pull request edited: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
@@ -385,31 +374,24 @@ func getDiscordPullRequestPayload(p *api.PullRequestPayload, meta *DiscordMeta)
title = fmt.Sprintf("[%s] Pull request assigned to %s: #%d by %s", p.Repository.FullName,
strings.Join(list, ", "),
p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
color = greenColor
case api.HookIssueUnassigned:
title = fmt.Sprintf("[%s] Pull request unassigned: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
color = yellowColor
case api.HookIssueLabelUpdated:
title = fmt.Sprintf("[%s] Pull request labels updated: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
color = yellowColor
case api.HookIssueLabelCleared:
title = fmt.Sprintf("[%s] Pull request labels cleared: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
color = yellowColor
case api.HookIssueSynchronized:
title = fmt.Sprintf("[%s] Pull request synchronized: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
color = yellowColor
case api.HookIssueMilestoned:
title = fmt.Sprintf("[%s] Pull request milestone: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
color = yellowColor
case api.HookIssueDemilestoned:
title = fmt.Sprintf("[%s] Pull request clear milestone: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
color = yellowColor
}
diff --git a/modules/webhook/msteams.go b/modules/webhook/msteams.go
index 2636e29983..8ff9bb5ba4 100644
--- a/modules/webhook/msteams.go
+++ b/modules/webhook/msteams.go
@@ -277,10 +277,8 @@ func getMSTeamsIssuesPayload(p *api.IssuePayload) (*MSTeamsPayload, error) {
case api.HookIssueClosed:
title = fmt.Sprintf("[%s] Issue closed: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
color = redColor
- text = p.Issue.Body
case api.HookIssueReOpened:
title = fmt.Sprintf("[%s] Issue re-opened: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
color = yellowColor
case api.HookIssueEdited:
title = fmt.Sprintf("[%s] Issue edited: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
@@ -289,31 +287,24 @@ func getMSTeamsIssuesPayload(p *api.IssuePayload) (*MSTeamsPayload, error) {
case api.HookIssueAssigned:
title = fmt.Sprintf("[%s] Issue assigned to %s: #%d %s", p.Repository.FullName,
p.Issue.Assignee.UserName, p.Index, p.Issue.Title)
- text = p.Issue.Body
color = greenColor
case api.HookIssueUnassigned:
title = fmt.Sprintf("[%s] Issue unassigned: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
color = yellowColor
case api.HookIssueLabelUpdated:
title = fmt.Sprintf("[%s] Issue labels updated: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
color = yellowColor
case api.HookIssueLabelCleared:
title = fmt.Sprintf("[%s] Issue labels cleared: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
color = yellowColor
case api.HookIssueSynchronized:
title = fmt.Sprintf("[%s] Issue synchronized: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
color = yellowColor
case api.HookIssueMilestoned:
title = fmt.Sprintf("[%s] Issue milestone: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
color = yellowColor
case api.HookIssueDemilestoned:
title = fmt.Sprintf("[%s] Issue clear milestone: #%d %s", p.Repository.FullName, p.Index, p.Issue.Title)
- text = p.Issue.Body
color = yellowColor
}
@@ -447,10 +438,8 @@ func getMSTeamsPullRequestPayload(p *api.PullRequestPayload) (*MSTeamsPayload, e
title = fmt.Sprintf("[%s] Pull request closed: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
color = redColor
}
- text = p.PullRequest.Body
case api.HookIssueReOpened:
title = fmt.Sprintf("[%s] Pull request re-opened: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
color = yellowColor
case api.HookIssueEdited:
title = fmt.Sprintf("[%s] Pull request edited: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
@@ -464,31 +453,24 @@ func getMSTeamsPullRequestPayload(p *api.PullRequestPayload) (*MSTeamsPayload, e
title = fmt.Sprintf("[%s] Pull request assigned to %s: #%d by %s", p.Repository.FullName,
strings.Join(list, ", "),
p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
color = greenColor
case api.HookIssueUnassigned:
title = fmt.Sprintf("[%s] Pull request unassigned: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
color = yellowColor
case api.HookIssueLabelUpdated:
title = fmt.Sprintf("[%s] Pull request labels updated: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
color = yellowColor
case api.HookIssueLabelCleared:
title = fmt.Sprintf("[%s] Pull request labels cleared: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
color = yellowColor
case api.HookIssueSynchronized:
title = fmt.Sprintf("[%s] Pull request synchronized: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
color = yellowColor
case api.HookIssueMilestoned:
title = fmt.Sprintf("[%s] Pull request milestone: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
color = yellowColor
case api.HookIssueDemilestoned:
title = fmt.Sprintf("[%s] Pull request clear milestone: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
color = yellowColor
}
diff --git a/modules/webhook/telegram.go b/modules/webhook/telegram.go
index 4e67b22954..d95ee0f73f 100644
--- a/modules/webhook/telegram.go
+++ b/modules/webhook/telegram.go
@@ -135,11 +135,9 @@ func getTelegramIssuesPayload(p *api.IssuePayload) (*TelegramPayload, error) {
case api.HookIssueClosed:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Issue closed: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.Issue.URL, p.Index, p.Issue.Title)
- text = p.Issue.Body
case api.HookIssueReOpened:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Issue re-opened: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.Issue.URL, p.Index, p.Issue.Title)
- text = p.Issue.Body
case api.HookIssueEdited:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Issue edited: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.Issue.URL, p.Index, p.Issue.Title)
@@ -147,31 +145,24 @@ func getTelegramIssuesPayload(p *api.IssuePayload) (*TelegramPayload, error) {
case api.HookIssueAssigned:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Issue assigned to %s: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.Issue.Assignee.UserName, p.Issue.URL, p.Index, p.Issue.Title)
- text = p.Issue.Body
case api.HookIssueUnassigned:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Issue unassigned: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.Issue.URL, p.Index, p.Issue.Title)
- text = p.Issue.Body
case api.HookIssueLabelUpdated:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Issue labels updated: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.Issue.URL, p.Index, p.Issue.Title)
- text = p.Issue.Body
case api.HookIssueLabelCleared:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Issue labels cleared: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.Issue.URL, p.Index, p.Issue.Title)
- text = p.Issue.Body
case api.HookIssueSynchronized:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Issue synchronized: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.Issue.URL, p.Index, p.Issue.Title)
- text = p.Issue.Body
case api.HookIssueMilestoned:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Issue milestone: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.Issue.URL, p.Index, p.Issue.Title)
- text = p.Issue.Body
case api.HookIssueDemilestoned:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Issue clear milestone: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.Issue.URL, p.Index, p.Issue.Title)
- text = p.Issue.Body
}
return &TelegramPayload{
@@ -215,11 +206,9 @@ func getTelegramPullRequestPayload(p *api.PullRequestPayload) (*TelegramPayload,
title = fmt.Sprintf(`[<a href="%s">%s</a>] Pull request closed: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.PullRequest.HTMLURL, p.Index, p.PullRequest.Title)
}
- text = p.PullRequest.Body
case api.HookIssueReOpened:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Pull request re-opened: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.PullRequest.HTMLURL, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
case api.HookIssueEdited:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Pull request edited: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.PullRequest.HTMLURL, p.Index, p.PullRequest.Title)
@@ -231,31 +220,24 @@ func getTelegramPullRequestPayload(p *api.PullRequestPayload) (*TelegramPayload,
}
title = fmt.Sprintf(`[<a href="%s">%s</a>] Pull request assigned to %s: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
list, p.PullRequest.HTMLURL, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
case api.HookIssueUnassigned:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Pull request unassigned: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.PullRequest.HTMLURL, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
case api.HookIssueLabelUpdated:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Pull request labels updated: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.PullRequest.HTMLURL, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
case api.HookIssueLabelCleared:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Pull request labels cleared: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.PullRequest.HTMLURL, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
case api.HookIssueSynchronized:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Pull request synchronized: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.PullRequest.HTMLURL, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
case api.HookIssueMilestoned:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Pull request milestone: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.PullRequest.HTMLURL, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
case api.HookIssueDemilestoned:
title = fmt.Sprintf(`[<a href="%s">%s</a>] Pull request clear milestone: <a href="%s">#%d %s</a>`, p.Repository.HTMLURL, p.Repository.FullName,
p.PullRequest.HTMLURL, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
}
return &TelegramPayload{