Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions bridge/mattermost/mattermost.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,28 +582,14 @@ func (m *Mattermost) GetChannels() []*bridge.ChannelInfo {

func (m *Mattermost) GetChannel(channelID string) (*bridge.ChannelInfo, error) {
if channelID == "" || strings.HasPrefix(channelID, "&") || channelID == m.mc.User.Nickname || channelID == m.mc.User.Username {
return nil, errors.New("channel not found")
}

for _, channel := range m.GetChannels() {
if channel.ID == channelID {
return channel, nil
}
}

m.UpdateChannels()

for _, channel := range m.GetChannels() {
if channel.ID == channelID {
return channel, nil
}
return nil, errors.New("invalid channel id")
}

// Fallback if it's not found in the cache.
mmchannel, _, err := m.mc.Client.GetChannel(channelID, "")
if err != nil {
mmchannel := m.mc.GetChannel(channelID)
if mmchannel == nil {
return nil, errors.New("channel not found")
}

return &bridge.ChannelInfo{
Name: mmchannel.Name,
ID: mmchannel.Id,
Expand Down
217 changes: 92 additions & 125 deletions vendor/github.com/matterbridge/matterclient/channels.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading