@@ -91,12 +91,11 @@ func getIssuesCommentInfo(p *api.IssueCommentPayload) (title, link, by, operator
9191 return title , link , by , operator
9292}
9393
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 )
9797 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 )
10099
101100 switch p .Action {
102101 case api .HookIssueOpened :
@@ -135,26 +134,23 @@ func getIssuesPayloadInfo(p *api.IssuePayload, linkFormatter linkFormatter, with
135134 text += fmt .Sprintf (" by %s" , linkFormatter (setting .AppURL + url .PathEscape (p .Sender .UserName ), p .Sender .UserName ))
136135 }
137136
138- var attachmentText string
139137 if p .Action == api .HookIssueOpened || p .Action == api .HookIssueEdited {
140- attachmentText = p .Issue .Body
138+ extraMarkdown = p .Issue .Body
141139 }
142140
143- return text , issueTitle , attachmentText , color
141+ return text , issueTitle , extraMarkdown , color
144142}
145143
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 )
149147 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 )
153149
154150 switch p .Action {
155151 case api .HookIssueOpened :
156152 text = fmt .Sprintf ("[%s] Pull request opened: %s" , repoLink , titleLink )
157- attachmentText = p .PullRequest .Body
153+ extraMarkdown = p .PullRequest .Body
158154 color = greenColor
159155 case api .HookIssueClosed :
160156 if p .PullRequest .HasMerged {
@@ -168,7 +164,7 @@ func getPullRequestPayloadInfo(p *api.PullRequestPayload, linkFormatter linkForm
168164 text = fmt .Sprintf ("[%s] Pull request re-opened: %s" , repoLink , titleLink )
169165 case api .HookIssueEdited :
170166 text = fmt .Sprintf ("[%s] Pull request edited: %s" , repoLink , titleLink )
171- attachmentText = p .PullRequest .Body
167+ extraMarkdown = p .PullRequest .Body
172168 case api .HookIssueAssigned :
173169 list := make ([]string , len (p .PullRequest .Assignees ))
174170 for i , user := range p .PullRequest .Assignees {
@@ -193,7 +189,7 @@ func getPullRequestPayloadInfo(p *api.PullRequestPayload, linkFormatter linkForm
193189 text = fmt .Sprintf ("[%s] Pull request milestone cleared: %s" , repoLink , titleLink )
194190 case api .HookIssueReviewed :
195191 text = fmt .Sprintf ("[%s] Pull request reviewed: %s" , repoLink , titleLink )
196- attachmentText = p .Review .Content
192+ extraMarkdown = p .Review .Content
197193 case api .HookIssueReviewRequested :
198194 text = fmt .Sprintf ("[%s] Pull request review requested: %s" , repoLink , titleLink )
199195 case api .HookIssueReviewRequestRemoved :
@@ -203,7 +199,7 @@ func getPullRequestPayloadInfo(p *api.PullRequestPayload, linkFormatter linkForm
203199 text += fmt .Sprintf (" by %s" , linkFormatter (setting .AppURL + p .Sender .UserName , p .Sender .UserName ))
204200 }
205201
206- return text , issueTitle , attachmentText , color
202+ return text , issueTitle , extraMarkdown , color
207203}
208204
209205func getReleasePayloadInfo (p * api.ReleasePayload , linkFormatter linkFormatter , withSender bool ) (text string , color int ) {
0 commit comments