Skip to content

Commit

Permalink
refactor: use header block for msg titles
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Gillson <tyler.gillson@gmail.com>
  • Loading branch information
TylerGillson committed Nov 10, 2023
1 parent 1233488 commit a6ce7af
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/sinks/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ func (s *SlackSink) buildSlackBlocks(r v1alpha1.ValidationResult) []slack.Block
state = fmt.Sprintf("*State:* %s :red_circle:", r.Status.State)
}
blocks := []slack.Block{
slack.NewSectionBlock(newTextBlockObject(fmt.Sprintf("*%s Validator*: %s", r.Spec.Plugin, r.Name)), nil, nil),
slack.NewHeaderBlock(&slack.TextBlockObject{
Type: slack.PlainTextType,
Text: fmt.Sprintf("%s Validator: %s", r.Spec.Plugin, r.Name),
}),
slack.NewSectionBlock(newTextBlockObject(state), nil, nil),
slack.NewDividerBlock(),
}
Expand Down Expand Up @@ -125,5 +128,5 @@ func newTextBlockObject(s string) *slack.TextBlockObject {
s = strings.ReplaceAll(s, "&", "&amp;")
s = strings.ReplaceAll(s, "<", "&lt;")
s = strings.ReplaceAll(s, ">", "&gt;")
return slack.NewTextBlockObject("mrkdwn", s, false, true)
return slack.NewTextBlockObject(slack.MarkdownType, s, false, true)
}

0 comments on commit a6ce7af

Please sign in to comment.