forked from forgejo/forgejo
Modify the content format of the Feishu webhook (#25106)
close https://github.com/go-gitea/gitea/issues/24368 ## what my pull request does Since the official documentation states that custom bots do not support hyperlink functionality, simply adding it without making some formatting changes would result in an unappealing output. Therefore, I have modified the formatting of the output. Currently, it is only used for Feishu. --- [docs](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/im-v1/message/create_json#%E8%B6%85%E9%93%BE%E6%8E%A5%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E) <img width="641" alt="image" src="360e1c81
-ab64-4ef6-851e-aa450d6e85a4"> - Issue <img width="423" alt="image" src="519f6fae
-81ab-4ec8-89b8-f6a73ff93783"> - Issue Comment <img width="548" alt="image" src="749c0d1c
-3657-431e-b787-8bf4c23cce83"> - Assign <img width="431" alt="image" src="066f99e5
-eabb-455d-91fb-a8359cc26dc7"> <img width="457" alt="image" src="c6c10f99
-db83-46ef-a775-4c91979fa68f"> - Merge <img width="408" alt="image" src="e627bf43
-5954-45aa-acf6-261ee046802f"> - PullRequest <img width="425" alt="image" src="72cfa714
-d3fa-4fb9-abdd-e8508d756056">
This commit is contained in:
parent
f67f57a4c2
commit
5104c887d3
4 changed files with 111 additions and 15 deletions
|
@ -72,7 +72,7 @@ func TestFeishuPayload(t *testing.T) {
|
|||
require.NotNil(t, pl)
|
||||
require.IsType(t, &FeishuPayload{}, pl)
|
||||
|
||||
assert.Equal(t, "#2 crash\r\n[test/repo] Issue opened: #2 crash by user1\r\n\r\nissue body", pl.(*FeishuPayload).Content.Text)
|
||||
assert.Equal(t, "[Issue-test/repo #2]: opened\ncrash\nhttp://localhost:3000/test/repo/issues/2\nIssue by user1\nOperator: user1\nAssignees: user1\n\nissue body", pl.(*FeishuPayload).Content.Text)
|
||||
|
||||
p.Action = api.HookIssueClosed
|
||||
pl, err = d.Issue(p)
|
||||
|
@ -80,7 +80,7 @@ func TestFeishuPayload(t *testing.T) {
|
|||
require.NotNil(t, pl)
|
||||
require.IsType(t, &FeishuPayload{}, pl)
|
||||
|
||||
assert.Equal(t, "#2 crash\r\n[test/repo] Issue closed: #2 crash by user1", pl.(*FeishuPayload).Content.Text)
|
||||
assert.Equal(t, "[Issue-test/repo #2]: closed\ncrash\nhttp://localhost:3000/test/repo/issues/2\nIssue by user1\nOperator: user1\nAssignees: user1\n\nissue body", pl.(*FeishuPayload).Content.Text)
|
||||
})
|
||||
|
||||
t.Run("IssueComment", func(t *testing.T) {
|
||||
|
@ -92,7 +92,7 @@ func TestFeishuPayload(t *testing.T) {
|
|||
require.NotNil(t, pl)
|
||||
require.IsType(t, &FeishuPayload{}, pl)
|
||||
|
||||
assert.Equal(t, "#2 crash\r\n[test/repo] New comment on issue #2 crash by user1\r\n\r\nmore info needed", pl.(*FeishuPayload).Content.Text)
|
||||
assert.Equal(t, "[Comment-test/repo #2]: created\ncrash\nhttp://localhost:3000/test/repo/issues/2\nIssue by user1\nOperator: user1\n\nmore info needed", pl.(*FeishuPayload).Content.Text)
|
||||
})
|
||||
|
||||
t.Run("PullRequest", func(t *testing.T) {
|
||||
|
@ -104,7 +104,7 @@ func TestFeishuPayload(t *testing.T) {
|
|||
require.NotNil(t, pl)
|
||||
require.IsType(t, &FeishuPayload{}, pl)
|
||||
|
||||
assert.Equal(t, "#12 Fix bug\r\n[test/repo] Pull request opened: #12 Fix bug by user1\r\n\r\nfixes bug #2", pl.(*FeishuPayload).Content.Text)
|
||||
assert.Equal(t, "[PullRequest-test/repo #12]: opened\nFix bug\nhttp://localhost:3000/test/repo/pulls/12\nPullRequest by user1\nOperator: user1\nAssignees: user1\n\nfixes bug #2", pl.(*FeishuPayload).Content.Text)
|
||||
})
|
||||
|
||||
t.Run("PullRequestComment", func(t *testing.T) {
|
||||
|
@ -116,7 +116,7 @@ func TestFeishuPayload(t *testing.T) {
|
|||
require.NotNil(t, pl)
|
||||
require.IsType(t, &FeishuPayload{}, pl)
|
||||
|
||||
assert.Equal(t, "#12 Fix bug\r\n[test/repo] New comment on pull request #12 Fix bug by user1\r\n\r\nchanges requested", pl.(*FeishuPayload).Content.Text)
|
||||
assert.Equal(t, "[Comment-test/repo #12]: created\nFix bug\nhttp://localhost:3000/test/repo/pulls/12\nPullRequest by user1\nOperator: user1\n\nchanges requested", pl.(*FeishuPayload).Content.Text)
|
||||
})
|
||||
|
||||
t.Run("Review", func(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue