Parse attachments only if they're passed from Gitlab.

This commit is contained in:
Stanislav Nikitin 2017-09-19 00:57:20 +05:00
parent 729fa71442
commit 008bbdb637

View File

@ -305,9 +305,11 @@ func (gp GitlabParser) ParseMessage(message slackmessage.SlackMessage) map[strin
var data map[string]string var data map[string]string
if len(message.Attachments) > 0 {
if strings.Contains(message.Attachments[0].Text, "Pipeline") && strings.Contains(message.Attachments[0].Text, "of branch") { if strings.Contains(message.Attachments[0].Text, "Pipeline") && strings.Contains(message.Attachments[0].Text, "of branch") {
data = gp.parsePipelineMessage(message) data = gp.parsePipelineMessage(message)
} }
}
if strings.Contains(message.Text, "pushed to") { if strings.Contains(message.Text, "pushed to") {
data = gp.parseCommit(message) data = gp.parseCommit(message)