这是indexloc提供的服务,不要输入任何密码
Skip to content

NewRichTextSectionChannelElement incorrectly sets type: text instead of type: channel #1464

@jubenitezg

Description

@jubenitezg

What happened

The slack.NewRichTextChannelElement functions returns a RichTextElement with "type": "text" instead of "type": "channel". Causing the block to be invalid since the value for "text" is missing and not displaying channels correctly.

slack/block_rich_text.go

Lines 329 to 331 in e29b7e3

func NewRichTextSectionChannelElement(channelID string, style *RichTextSectionTextStyle) *RichTextSectionChannelElement {
return &RichTextSectionChannelElement{
Type: RTSEText,

Workaround

Use the struct value

slack.RichTextSectionChannelElement{
	Type:      slack.RTSEChannel,
	ChannelID: "channel-id",
}

Expected behavior

The function should create a RichTextChannel element with type channel

Steps to reproduce

  1. Use the slack.NewRichTextChannelElement function in blocks code.
  2. Attempt to send via PostMessage

reproducible code

slack.NewRichTextChannelElement("channel_id", nil)

manifest.yaml

N/A

Versions

  • Go: 1.23.9
  • slack-go/slack: v0.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions