Skip to content

Commit

Permalink
Merge pull request #1017 from vflaux/teams_adaptive_cards_full_width
Browse files Browse the repository at this point in the history
msteams notifier: adaptive cards full width
  • Loading branch information
matheuscscp authored Jan 15, 2025
2 parents d455ac6 + 56c5a5a commit 5469e2a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/notifier/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ type msAdaptiveCardContent struct {
Type string `json:"type"`
Version string `json:"version"`
Body []msAdaptiveCardBodyElement `json:"body"`
MSTeams msAdaptiveCardMSTeams `json:"msteams"`
}

type msAdaptiveCardBodyElement struct {
Expand All @@ -98,6 +99,10 @@ type msAdaptiveCardContainer struct {
Items []msAdaptiveCardBodyElement `json:"items,omitempty"`
}

type msAdaptiveCardMSTeams struct {
Width string `json:"width,omitempty"`
}

type msAdaptiveCardTextBlock struct {
Text string `json:"text,omitempty"`
Size string `json:"size,omitempty"`
Expand Down Expand Up @@ -237,6 +242,9 @@ func buildMSTeamsAdaptiveCardPayload(event *eventv1.Event, objName string) *msAd
Schema: "http://adaptivecards.io/schemas/adaptive-card.json",
Type: "AdaptiveCard",
Version: msAdaptiveCardVersion,
MSTeams: msAdaptiveCardMSTeams{
Width: "Full",
},
Body: []msAdaptiveCardBodyElement{
{
Type: "Container",
Expand Down
3 changes: 3 additions & 0 deletions internal/notifier/teams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ func TestMSTeams_Post(t *testing.T) {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.4",
"msteams": map[string]any{
"width": "Full",
},
"body": []any{
map[string]any{
"type": "Container",
Expand Down

0 comments on commit 5469e2a

Please sign in to comment.