From 4659b5bd409cd18e0064260fd6f601d3a3f6b0d6 Mon Sep 17 00:00:00 2001 From: Haw Loeung Date: Thu, 3 Nov 2022 20:11:51 +1100 Subject: [PATCH] Fallback to use API for getting channel ID when not in the cache --- matterclient/channels.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/matterclient/channels.go b/matterclient/channels.go index 13d3277d..23a7fc21 100644 --- a/matterclient/channels.go +++ b/matterclient/channels.go @@ -73,7 +73,14 @@ func (m *MMClient) getChannelIdTeam(name string, teamId string) string { //nolin } } } - return "" + + // Fallback if it's not found in the t.Channels or t.MoreChannels cache. + // This also let's us join private channels. + channel, _ := m.Client.GetChannelByName(name, teamId, "") + if channel == nil { + return "" + } + return channel.Id } func (m *MMClient) GetChannelName(channelId string) string { //nolint:golint