Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No filter object in multi_conversation_select #1192

Open
imamfzn opened this issue Apr 10, 2023 · 0 comments · May be fixed by #1191
Open

No filter object in multi_conversation_select #1192

imamfzn opened this issue Apr 10, 2023 · 0 comments · May be fixed by #1191

Comments

@imamfzn
Copy link

imamfzn commented Apr 10, 2023

Hi team, currently there is no filter field in the multi_conversation_select block element type like below:

slack/block_element.go

Lines 270 to 283 in b4b5a64

type MultiSelectBlockElement struct {
Type string `json:"type,omitempty"`
Placeholder *TextBlockObject `json:"placeholder,omitempty"`
ActionID string `json:"action_id,omitempty"`
Options []*OptionBlockObject `json:"options,omitempty"`
OptionGroups []*OptionGroupBlockObject `json:"option_groups,omitempty"`
InitialOptions []*OptionBlockObject `json:"initial_options,omitempty"`
InitialUsers []string `json:"initial_users,omitempty"`
InitialConversations []string `json:"initial_conversations,omitempty"`
InitialChannels []string `json:"initial_channels,omitempty"`
MinQueryLength *int `json:"min_query_length,omitempty"`
MaxSelectedItems *int `json:"max_selected_items,omitempty"`
Confirm *ConfirmationBlockObject `json:"confirm,omitempty"`
}

At the moment, only the conversation_select which has the filter object. In the slack documentation, it said the filter object also supported in the multi_conversation_select.

As a workaround to bypass this issue, i create a conversation_select block element, and change the element type once it created to be multi_conversation_select, like:

var modal slack.ModalViewRequest
// omitted code to parsed/unmarshal the json kit to be the the view struct
// ...

block := modal.Blocks.BlockSet[0].(*slack.SectionBlock)
block.Accessory.SelectElement.Type = "multi_conversations_select"
modal.Blocks.BlockSet[0] = block
Example json kit template used
{
  "type": "modal",
  "title": {
    "type": "plain_text",
    "text": "Add to Channel",
    "emoji": true
  },
  "submit": {
    "type": "plain_text",
    "text": "Add",
    "emoji": true
  },
  "close": {
    "type": "plain_text",
    "text": "Close",
    "emoji": true
  },
  "blocks": [
    {
      "type": "section",
      "block_id": "block_add_to_channel",
      "text": {
        "type": "mrkdwn",
        "text": "*Add these people to {{.ChannelName}}*"
      },
      "accessory": {
        "action_id": "action_add_to_channel",
        "type": "conversations_select",
        "placeholder": {
          "type": "plain_text",
          "text": "Add people and/or channels"
        },
        "filter": {
          "include": [
            "im",
            "public"
          ],
          "exclude_bot_users": true
        }
      }
    }
  ]
}

But i think that way is not clean, since we actually can directly create the multi_conversation_select with filter object based on the slack documentation.

I create my own pull request in #1191, please help to review and merge / please help to fix that issue if my PR is not suitable.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants