summaryrefslogtreecommitdiffstats
path: root/models/webhook_dingtalk.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/webhook_dingtalk.go')
-rw-r--r--models/webhook_dingtalk.go24
1 files changed, 19 insertions, 5 deletions
diff --git a/models/webhook_dingtalk.go b/models/webhook_dingtalk.go
index 6a4bdaf06e..1c6c0a83b8 100644
--- a/models/webhook_dingtalk.go
+++ b/models/webhook_dingtalk.go
@@ -183,22 +183,36 @@ func getDingtalkIssuesPayload(p *api.IssuePayload) (*DingtalkPayload, error) {
}
func getDingtalkIssueCommentPayload(p *api.IssueCommentPayload) (*DingtalkPayload, error) {
- title := fmt.Sprintf("#%d %s", p.Issue.Index, p.Issue.Title)
+ title := fmt.Sprintf("#%d: %s", p.Issue.Index, p.Issue.Title)
url := fmt.Sprintf("%s/issues/%d#%s", p.Repository.HTMLURL, p.Issue.Index, CommentHashTag(p.Comment.ID))
var content string
switch p.Action {
case api.HookIssueCommentCreated:
- title = "New comment: " + title
+ if p.IsPull {
+ title = "New comment on pull request " + title
+ } else {
+ title = "New comment on issue " + title
+ }
content = p.Comment.Body
case api.HookIssueCommentEdited:
- title = "Comment edited: " + title
+ if p.IsPull {
+ title = "Comment edited on pull request " + title
+ } else {
+ title = "Comment edited on issue " + title
+ }
content = p.Comment.Body
case api.HookIssueCommentDeleted:
- title = "Comment deleted: " + title
+ if p.IsPull {
+ title = "Comment deleted on pull request " + title
+ } else {
+ title = "Comment deleted on issue " + title
+ }
url = fmt.Sprintf("%s/issues/%d", p.Repository.HTMLURL, p.Issue.Index)
content = p.Comment.Body
}
+ title = fmt.Sprintf("[%s] %s", p.Repository.FullName, title)
+
return &DingtalkPayload{
MsgType: "actionCard",
ActionCard: dingtalk.ActionCard{
@@ -282,7 +296,7 @@ func getDingtalkPullRequestApprovalPayload(p *api.PullRequestPayload, event Hook
}
title = fmt.Sprintf("[%s] Pull request review %s : #%d %s", p.Repository.FullName, action, p.Index, p.PullRequest.Title)
- text = p.PullRequest.Body
+ text = p.Review.Content
}