MCPcopy Create free account
hub / github.com/gogs/gogs / getDingtalkIssueCommentPayload

Function getDingtalkIssueCommentPayload

internal/database/webhook_dingtalk.go:188–207  ·  view source on GitHub ↗
(p *api.IssueCommentPayload)

Source from the content-addressed store, hash-verified

186}
187
188func getDingtalkIssueCommentPayload(p *api.IssueCommentPayload) *DingtalkPayload {
189 issueName := fmt.Sprintf("#%d %s", p.Issue.Index, p.Issue.Title)
190 commentURL := fmt.Sprintf("%s/issues/%d", p.Repository.HTMLURL, p.Issue.Index)
191 if p.Action != api.HOOK_ISSUE_COMMENT_DELETED {
192 commentURL += "#" + CommentHashTag(p.Comment.ID)
193 }
194
195 issueURL := fmt.Sprintf("%s/issues/%d", p.Repository.HTMLURL, p.Issue.Index)
196
197 actionCard := NewDingtalkActionCard("View Issue Comment", commentURL)
198 actionCard.Text += "# Issue Comment " + strings.Title(string(p.Action))
199 actionCard.Text += "\n- Issue: " + MarkdownLinkFormatter(issueURL, issueName)
200 actionCard.Text += "\n- Comment content: "
201 actionCard.Text += "\n> " + p.Comment.Body
202
203 return &DingtalkPayload{
204 MsgType: "actionCard",
205 ActionCard: actionCard,
206 }
207}
208
209func getDingtalkPullRequestPayload(p *api.PullRequestPayload) *DingtalkPayload {
210 title := "# Pull Request " + strings.Title(string(p.Action))

Callers 1

GetDingtalkPayloadFunction · 0.85

Calls 5

CommentHashTagFunction · 0.85
NewDingtalkActionCardFunction · 0.85
stringFunction · 0.85
MarkdownLinkFormatterFunction · 0.85
TitleMethod · 0.80

Tested by

no test coverage detected