summaryrefslogtreecommitdiffstats
path: root/bridge/slack/slack.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2019-06-14 00:42:55 +0200
committerGitHub <noreply@github.com>2019-06-14 00:42:55 +0200
commit5619a75b05f932bd45c8eb7b32b6db5d1dbfaf93 (patch)
tree2181d5ab1b6c527f8736dcf9aa791dcc7a06f30f /bridge/slack/slack.go
parent53dfb78215688bcc84a2f3721a995c061544ce5e (diff)
downloadmatterbridge-msglm-5619a75b05f932bd45c8eb7b32b6db5d1dbfaf93.tar.gz
matterbridge-msglm-5619a75b05f932bd45c8eb7b32b6db5d1dbfaf93.tar.bz2
matterbridge-msglm-5619a75b05f932bd45c8eb7b32b6db5d1dbfaf93.zip
Fix regression in autojoining with legacy tokens (slack). Fixes #651 (#848)
Diffstat (limited to 'bridge/slack/slack.go')
-rw-r--r--bridge/slack/slack.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/bridge/slack/slack.go b/bridge/slack/slack.go
index 36b74b99..2aaa2cb1 100644
--- a/bridge/slack/slack.go
+++ b/bridge/slack/slack.go
@@ -32,6 +32,7 @@ type Bslack struct {
channels *channels
users *users
+ legacy bool
}
const (
@@ -151,6 +152,18 @@ func (b *Bslack) JoinChannel(channel config.ChannelInfo) error {
return nil
}
+ // try to join a channel when in legacy
+ if b.legacy {
+ _, err := b.sc.JoinChannel(channel.Name)
+ if err != nil {
+ switch err.Error() {
+ case "name_taken", "restricted_action":
+ case "default":
+ return err
+ }
+ }
+ }
+
b.channels.populateChannels(false)
channelInfo, err := b.channels.getChannel(channel.Name)
@@ -163,7 +176,8 @@ func (b *Bslack) JoinChannel(channel config.ChannelInfo) error {
channel.Name = channelInfo.Name
}
- if !channelInfo.IsMember {
+ // we can't join a channel unless we are using legacy tokens #651
+ if !channelInfo.IsMember && !b.legacy {
return fmt.Errorf("slack integration that matterbridge is using is not member of channel '%s', please add it manually", channelInfo.Name)
}
return nil