diff --git a/pkg/api/message.go b/pkg/api/message.go
index 1ddcc9ac0..9de5b43aa 100644
--- a/pkg/api/message.go
+++ b/pkg/api/message.go
@@ -24,6 +24,18 @@ const (
ExternalSelect SelectType = "external"
)
+// DividerStyle is a style of Divider element between section blocks.
+type DividerStyle string
+
+// Represents a divider styles.
+const (
+ // DividerStyleDefault put a block divider, like an
, to split up different sections inside of a single message.
+ // It is the default style for backwards compatibility.
+ DividerStyleDefault DividerStyle = ""
+ // DividerStyleTopNone
+ DividerStyleTopNone DividerStyle = "none"
+)
+
// MessageType defines the message type.
type MessageType string
@@ -126,8 +138,15 @@ type Body struct {
Plaintext string `json:"plaintext,omitempty" yaml:"plaintext"`
}
+// SectionStyle holds section style.
+type SectionStyle struct {
+ Divider DividerStyle `json:"divider,omitempty" yaml:"dividerStyle"`
+}
+
// Section holds section related fields.
type Section struct {
+ Style SectionStyle `json:"style,omitempty" yaml:"style"`
+
Base `json:",inline" yaml:"base"`
Buttons Buttons `json:"buttons,omitempty" yaml:"buttons"`
MultiSelect MultiSelect `json:"multiSelect,omitempty" yaml:"multiSelect"`
diff --git a/pkg/bot/interactive/help.go b/pkg/bot/interactive/help.go
index 7c4a3cfa1..300906871 100644
--- a/pkg/bot/interactive/help.go
+++ b/pkg/bot/interactive/help.go
@@ -107,15 +107,33 @@ func (h *HelpMessage) basicCommands() []api.Section {
}
func (h *HelpMessage) footer() []api.Section {
+ btns := api.Buttons{
+ h.btnBuilder.ForURL("Give feedback", "https://feedback.botkube.io", api.ButtonStylePrimary),
+ h.btnBuilder.ForURL("Read our docs", "https://docs.botkube.io"),
+ h.btnBuilder.ForURL("Join our Slack", "https://join.botkube.io"),
+ h.btnBuilder.ForURL("Follow us on Twitter", "https://twitter.com/botkube_io"),
+ }
+
+ if !remote.IsEnabled() {
+ return []api.Section{
+ {
+ Buttons: btns,
+ },
+ }
+ }
+
return []api.Section{
{
- Buttons: []api.Button{
- h.btnBuilder.ForURL("Give feedback", "https://feedback.botkube.io", api.ButtonStylePrimary),
- h.btnBuilder.ForURL("Read our docs", "https://docs.botkube.io"),
- h.btnBuilder.ForURL("Join our Slack", "https://join.botkube.io"),
- h.btnBuilder.ForURL("Follow us on Twitter", "https://twitter.com/botkube_io"),
+ Context: api.ContextItems{
+ {Text: fmt.Sprintf("👀 _All %s mentions and events are visible to your Botkube Cloud organisation’s administrators._", api.MessageBotNamePlaceholder)},
},
},
+ {
+ Style: api.SectionStyle{
+ Divider: api.DividerStyleTopNone,
+ },
+ Buttons: btns,
+ },
}
}
diff --git a/pkg/bot/slack_renderer.go b/pkg/bot/slack_renderer.go
index 4c2f0de83..120d89b94 100644
--- a/pkg/bot/slack_renderer.go
+++ b/pkg/bot/slack_renderer.go
@@ -81,13 +81,13 @@ func (b *SlackRenderer) RenderAsSlackBlocks(msg interactive.CoreMessage) []slack
blocks = append(blocks, b.mdTextSection(formatx.AdaptiveCodeBlock(msg.BaseBody.CodeBlock)))
}
- all := len(msg.Sections)
for idx, s := range msg.Sections {
- blocks = append(blocks, b.renderSection(s)...)
- if !(idx == all-1) { // if not the last one, append divider
+ if idx > 0 && s.Style.Divider != api.DividerStyleTopNone {
blocks = append(blocks, slack.NewDividerBlock())
}
+ blocks = append(blocks, b.renderSection(s)...)
}
+
for _, i := range msg.PlaintextInputs {
blocks = append(blocks, b.renderInput(i))
}
diff --git a/test/msg-layouts/help_test.go b/test/msg-layouts/help_test.go
index 90e200055..c0886d619 100644
--- a/test/msg-layouts/help_test.go
+++ b/test/msg-layouts/help_test.go
@@ -22,7 +22,7 @@ import (
// - Slack: https://app.slack.com/block-kit-builder/
// - Teams: https://adaptivecards.io/designer/
// - Discord: it's only markdown, just post as a normal message in discord channel
-// - Mattermost: it's only markdown, just post as a normal message in discord channel
+// - Mattermost: it's only markdown, just post as a normal message in mattermost channel
//
// To update the golden files:
//
diff --git a/test/msg-layouts/testdata/TestNewHelpMessage/cloud-slack-help.golden.json b/test/msg-layouts/testdata/TestNewHelpMessage/cloud-slack-help.golden.json
index 8b1453384..5d0f2f6e2 100644
--- a/test/msg-layouts/testdata/TestNewHelpMessage/cloud-slack-help.golden.json
+++ b/test/msg-layouts/testdata/TestNewHelpMessage/cloud-slack-help.golden.json
@@ -316,6 +316,15 @@
{
"type": "divider"
},
+ {
+ "type": "context",
+ "elements": [
+ {
+ "type": "mrkdwn",
+ "text": "👀 _All @Botkube mentions and events are visible to your Botkube Cloud organisation’s administrators._"
+ }
+ ]
+ },
{
"type": "actions",
"elements": [
diff --git a/test/msg-layouts/testdata/TestNewHelpMessage/cloud-teams-help.golden.json b/test/msg-layouts/testdata/TestNewHelpMessage/cloud-teams-help.golden.json
index 86d184846..96b30a8ab 100644
--- a/test/msg-layouts/testdata/TestNewHelpMessage/cloud-teams-help.golden.json
+++ b/test/msg-layouts/testdata/TestNewHelpMessage/cloud-teams-help.golden.json
@@ -451,6 +451,14 @@
}
]
},
+ {
+ "type": "TextBlock",
+ "text": "_👀 _All @Botkube mentions and events are visible to your Botkube Cloud organisation’s administrators.__",
+ "isSubtle": true,
+ "weight": "lighter",
+ "wrap": true,
+ "separator": true
+ },
{
"type": "ActionSet",
"actions": [