@@ -91,12 +91,11 @@ func getIssuesCommentInfo(p *api.IssueCommentPayload) (title, link, by, operator
91
91
return title , link , by , operator
92
92
}
93
93
94
- func getIssuesPayloadInfo (p * api.IssuePayload , linkFormatter linkFormatter , withSender bool ) (string , string , string , int ) {
95
- repoLink := linkFormatter ( p . Repository . HTMLURL , p . Repository . FullName )
96
- issueTitle : = fmt .Sprintf ("#%d %s" , p .Index , p .Issue .Title )
94
+ func getIssuesPayloadInfo (p * api.IssuePayload , linkFormatter linkFormatter , withSender bool ) (text , issueTitle , extraMarkdown string , color int ) {
95
+ color = yellowColor
96
+ issueTitle = fmt .Sprintf ("#%d %s" , p .Index , p .Issue .Title )
97
97
titleLink := linkFormatter (fmt .Sprintf ("%s/issues/%d" , p .Repository .HTMLURL , p .Index ), issueTitle )
98
- var text string
99
- color := yellowColor
98
+ repoLink := linkFormatter (p .Repository .HTMLURL , p .Repository .FullName )
100
99
101
100
switch p .Action {
102
101
case api .HookIssueOpened :
@@ -135,26 +134,23 @@ func getIssuesPayloadInfo(p *api.IssuePayload, linkFormatter linkFormatter, with
135
134
text += fmt .Sprintf (" by %s" , linkFormatter (setting .AppURL + url .PathEscape (p .Sender .UserName ), p .Sender .UserName ))
136
135
}
137
136
138
- var attachmentText string
139
137
if p .Action == api .HookIssueOpened || p .Action == api .HookIssueEdited {
140
- attachmentText = p .Issue .Body
138
+ extraMarkdown = p .Issue .Body
141
139
}
142
140
143
- return text , issueTitle , attachmentText , color
141
+ return text , issueTitle , extraMarkdown , color
144
142
}
145
143
146
- func getPullRequestPayloadInfo (p * api.PullRequestPayload , linkFormatter linkFormatter , withSender bool ) (string , string , string , int ) {
147
- repoLink := linkFormatter ( p . Repository . HTMLURL , p . Repository . FullName )
148
- issueTitle : = fmt .Sprintf ("#%d %s" , p .Index , p .PullRequest .Title )
144
+ func getPullRequestPayloadInfo (p * api.PullRequestPayload , linkFormatter linkFormatter , withSender bool ) (text , issueTitle , extraMarkdown string , color int ) {
145
+ color = yellowColor
146
+ issueTitle = fmt .Sprintf ("#%d %s" , p .Index , p .PullRequest .Title )
149
147
titleLink := linkFormatter (p .PullRequest .URL , issueTitle )
150
- var text string
151
- var attachmentText string
152
- color := yellowColor
148
+ repoLink := linkFormatter (p .Repository .HTMLURL , p .Repository .FullName )
153
149
154
150
switch p .Action {
155
151
case api .HookIssueOpened :
156
152
text = fmt .Sprintf ("[%s] Pull request opened: %s" , repoLink , titleLink )
157
- attachmentText = p .PullRequest .Body
153
+ extraMarkdown = p .PullRequest .Body
158
154
color = greenColor
159
155
case api .HookIssueClosed :
160
156
if p .PullRequest .HasMerged {
@@ -168,7 +164,7 @@ func getPullRequestPayloadInfo(p *api.PullRequestPayload, linkFormatter linkForm
168
164
text = fmt .Sprintf ("[%s] Pull request re-opened: %s" , repoLink , titleLink )
169
165
case api .HookIssueEdited :
170
166
text = fmt .Sprintf ("[%s] Pull request edited: %s" , repoLink , titleLink )
171
- attachmentText = p .PullRequest .Body
167
+ extraMarkdown = p .PullRequest .Body
172
168
case api .HookIssueAssigned :
173
169
list := make ([]string , len (p .PullRequest .Assignees ))
174
170
for i , user := range p .PullRequest .Assignees {
@@ -193,7 +189,7 @@ func getPullRequestPayloadInfo(p *api.PullRequestPayload, linkFormatter linkForm
193
189
text = fmt .Sprintf ("[%s] Pull request milestone cleared: %s" , repoLink , titleLink )
194
190
case api .HookIssueReviewed :
195
191
text = fmt .Sprintf ("[%s] Pull request reviewed: %s" , repoLink , titleLink )
196
- attachmentText = p .Review .Content
192
+ extraMarkdown = p .Review .Content
197
193
case api .HookIssueReviewRequested :
198
194
text = fmt .Sprintf ("[%s] Pull request review requested: %s" , repoLink , titleLink )
199
195
case api .HookIssueReviewRequestRemoved :
@@ -203,7 +199,7 @@ func getPullRequestPayloadInfo(p *api.PullRequestPayload, linkFormatter linkForm
203
199
text += fmt .Sprintf (" by %s" , linkFormatter (setting .AppURL + p .Sender .UserName , p .Sender .UserName ))
204
200
}
205
201
206
- return text , issueTitle , attachmentText , color
202
+ return text , issueTitle , extraMarkdown , color
207
203
}
208
204
209
205
func getReleasePayloadInfo (p * api.ReleasePayload , linkFormatter linkFormatter , withSender bool ) (text string , color int ) {
0 commit comments