From aba86855b5f71c9809d892a7eebc6b69872fcd5b Mon Sep 17 00:00:00 2001 From: Wim Date: Thu, 14 Nov 2019 00:04:39 +0100 Subject: Use own slack fork to fix #937 (#943) --- go.mod | 3 +++ go.sum | 2 ++ vendor/github.com/nlopes/slack/block_conv.go | 4 ++-- vendor/github.com/nlopes/slack/block_element.go | 14 ++++++++++++++ vendor/github.com/nlopes/slack/block_unknown.go | 14 ++++++++++++++ vendor/github.com/nlopes/slack/go.mod | 2 +- vendor/modules.txt | 2 +- 7 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 vendor/github.com/nlopes/slack/block_unknown.go diff --git a/go.mod b/go.mod index c9592111..76f41c16 100644 --- a/go.mod +++ b/go.mod @@ -36,6 +36,7 @@ require ( github.com/nelsonken/gomf v0.0.0-20180504123937-a9dd2f9deae9 github.com/nicksnyder/go-i18n v1.4.0 // indirect github.com/nlopes/slack v0.6.0 + //github.com/nlopes/slack v0.6.0 github.com/onsi/ginkgo v1.6.0 // indirect github.com/onsi/gomega v1.4.1 // indirect github.com/paulrosania/go-charset v0.0.0-20190326053356-55c9d7a5834c @@ -72,4 +73,6 @@ require ( replace github.com/bwmarrin/discordgo v0.19.0 => github.com/matterbridge/discordgo v0.0.0-20191026232317-01823f4ebba4 +replace github.com/nlopes/slack v0.6.0 => github.com/matterbridge/slack v0.1.1-0.20191113220225-25f80ef0a0d1 + go 1.13 diff --git a/go.sum b/go.sum index 2cfcb909..460ae891 100644 --- a/go.sum +++ b/go.sum @@ -131,6 +131,8 @@ github.com/matterbridge/gozulipbot v0.0.0-20190212232658-7aa251978a18 h1:fLhwXtW github.com/matterbridge/gozulipbot v0.0.0-20190212232658-7aa251978a18/go.mod h1:yAjnZ34DuDyPHMPHHjOsTk/FefW4JJjoMMCGt/8uuQA= github.com/matterbridge/logrus-prefixed-formatter v0.0.0-20180806162718-01618749af61 h1:R/MgM/eUyRBQx2FiH6JVmXck8PaAuKfe2M1tWIzW7nE= github.com/matterbridge/logrus-prefixed-formatter v0.0.0-20180806162718-01618749af61/go.mod h1:iXGEotOvwI1R1SjLxRc+BF5rUORTMtE0iMZBT2lxqAU= +github.com/matterbridge/slack v0.1.1-0.20191113220225-25f80ef0a0d1 h1:wXVBLvvMFMfqnDE6aVyxScanzRP1WIErz7+fY/9dhmY= +github.com/matterbridge/slack v0.1.1-0.20191113220225-25f80ef0a0d1/go.mod h1:2uCJim0Ct2z1Uj+XQq47KCLLC1b/9UTYaZOvDtbZfK4= github.com/mattermost/mattermost-server v5.5.0+incompatible h1:0wcLGgYtd+YImtLDPf2AOfpBHxbU4suATx+6XKw1XbU= github.com/mattermost/mattermost-server v5.5.0+incompatible/go.mod h1:5L6MjAec+XXQwMIt791Ganu45GKsSiM+I0tLR9wUj8Y= github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= diff --git a/vendor/github.com/nlopes/slack/block_conv.go b/vendor/github.com/nlopes/slack/block_conv.go index 619867ea..b9e61a95 100644 --- a/vendor/github.com/nlopes/slack/block_conv.go +++ b/vendor/github.com/nlopes/slack/block_conv.go @@ -61,7 +61,7 @@ func (b *Blocks) UnmarshalJSON(data []byte) error { case "section": block = &SectionBlock{} default: - return errors.New("unsupported block type") + block = &UnknownBlock{} } err = json.Unmarshal(r, block) @@ -127,7 +127,7 @@ func (b *BlockElements) UnmarshalJSON(data []byte) error { case "static_select", "external_select", "users_select", "conversations_select", "channels_select": blockElement = &SelectBlockElement{} default: - return errors.New("unsupported block element type") + blockElement = &UnknownBlockElement{} } err = json.Unmarshal(r, blockElement) diff --git a/vendor/github.com/nlopes/slack/block_element.go b/vendor/github.com/nlopes/slack/block_element.go index c62ba99c..5b1b4b01 100644 --- a/vendor/github.com/nlopes/slack/block_element.go +++ b/vendor/github.com/nlopes/slack/block_element.go @@ -62,6 +62,20 @@ type BlockElements struct { ElementSet []BlockElement `json:"elements,omitempty"` } +// UnknownBlockElement any block element that this library does not directly support. +// See the "Rich Elements" section at the following URL: +// https://api.slack.com/changelog/2019-09-what-they-see-is-what-you-get-and-more-and-less +// New block element types may be introduced by Slack at any time; this is a catch-all for any such block elements. +type UnknownBlockElement struct { + Type MessageElementType `json:"type"` + Elements BlockElements +} + +// ElementType returns the type of the Element +func (s UnknownBlockElement) ElementType() MessageElementType { + return s.Type +} + // ImageBlockElement An element to insert an image - this element can be used // in section and context blocks only. If you want a block with only an image // in it, you're looking for the image block. diff --git a/vendor/github.com/nlopes/slack/block_unknown.go b/vendor/github.com/nlopes/slack/block_unknown.go new file mode 100644 index 00000000..b5ce1e47 --- /dev/null +++ b/vendor/github.com/nlopes/slack/block_unknown.go @@ -0,0 +1,14 @@ +package slack + +// UnknownBlock represents a block type that is not yet known. This block type exists to prevent Slack from introducing +// new and unknown block types that break this library. +type UnknownBlock struct { + Type MessageBlockType `json:"type"` + BlockID string `json:"block_id,omitempty"` + Elements BlockElements `json:"elements"` +} + +// BlockType returns the type of the block +func (b UnknownBlock) BlockType() MessageBlockType { + return b.Type +} diff --git a/vendor/github.com/nlopes/slack/go.mod b/vendor/github.com/nlopes/slack/go.mod index 87256eb1..a97bf381 100644 --- a/vendor/github.com/nlopes/slack/go.mod +++ b/vendor/github.com/nlopes/slack/go.mod @@ -1,4 +1,4 @@ -module github.com/nlopes/slack +module github.com/matterbridge/slack require ( github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/vendor/modules.txt b/vendor/modules.txt index ee645b61..9f7d85b4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -131,7 +131,7 @@ github.com/nicksnyder/go-i18n/i18n github.com/nicksnyder/go-i18n/i18n/bundle github.com/nicksnyder/go-i18n/i18n/language github.com/nicksnyder/go-i18n/i18n/translation -# github.com/nlopes/slack v0.6.0 +# github.com/nlopes/slack v0.6.0 => github.com/matterbridge/slack v0.1.1-0.20191113220225-25f80ef0a0d1 github.com/nlopes/slack github.com/nlopes/slack/internal/errorsx github.com/nlopes/slack/internal/timex -- cgit v1.2.3