Comments (21)
Thanks to @hloeung this is now fixed in master
from matterircd.
Might be related to #237
from matterircd.
wrt to /part => partfake
see https://github.com/42wim/matterircd/blob/master/matterircd.toml.example#L83-L90
/join should work.. run with --debug
and rebuild from master if you're using mattermost 7.x also put your defaultTeam
https://github.com/42wim/matterircd/blob/master/matterircd.toml.example#L51 otherwise you need to do /join #yourteam/whatever
from matterircd.
Ah sorry I overlooked the partfake setting.
About joining channels, we're using MM 6.x but then I already set defaultTeam to our current sole team.
time="2022-10-17T04:19:33+02:00" level=debug msg="<- JOIN #some-existing-public-channel" module=matterircd
time="2022-10-17T04:19:33+02:00" level=debug msg="Joining " prefix=matterclient
time="2022-10-17T04:19:33+02:00" level=debug msg="join channel some-existing-public-channel, id , err: : Invalid or missing channel_id parameter in request URL., "
time="2022-10-17T04:19:33+02:00" level=error msg="Cannot join channel some-existing-public-channel, id , err: cannot join channel (+i)" module=matterircd
time="2022-10-17T04:19:33+02:00" level=debug msg="-> :matterircd 473 loic #some-existing-public-channel :Cannot join channel (+i)" module=matterircd
time="2022-10-17T04:19:33+02:00" level=debug msg="Executed &irc.Message{Prefix:(*irc.Prefix)(nil), Command:\"JOIN\", Params:[]string{\"#some-existing-public-channel\"}, Trailing:\"\", EmptyTrailing:false} <nil>" module=matterircd
Same when using #myteam/some-existing-public-channel.
Let me know if there's anything I can test, or add to logging.
Cheers
from matterircd.
Well, this shows that it cannot find the channel.
This can be because the teamID/name is incorrect, or it doesn't have access to the channel.
Does your team name is something special, utf-8, spaces, special characters ? or is the channel something special as a name ?
Redacting too much information makes it harder to debug.
As a workaround just join the channel using the webbrowser, this should be a one-time action.
from matterircd.
The team name is nothing special, just "canonical". The channel itself is public and consists of letters and dashes only (and public information but then I did not see the point in keeping the name on this bug report).
Afaik, it has never worked for at least 2 people (including myself), on any channel we wanted to join.
We're indeed using the web version of MM when we need to join a channel, but I felt this issue should be reported.
from matterircd.
What mattermost version?
from matterircd.
Mattermost Version: 6.6.0
Database Schema Version: 78
from matterircd.
I can confirm this is the case and seems to do with the m.mc.GetChannelID()
call. I added some debugging earlier this morning:
[hloeung@dharkan matterircd]$ git diff
diff --git a/bridge/mattermost6/mattermost.go b/bridge/mattermost6/mattermost.go
index 0d9e4d3..fbcb8c2 100644
--- a/bridge/mattermost6/mattermost.go
+++ b/bridge/mattermost6/mattermost.go
@@ -182,20 +182,27 @@ func (m *Mattermost) Join(channelName string) (string, string, error) {
sp := strings.Split(channelName, "/")
if len(sp) > 1 {
+ logger.Infof("Haw sp0: %s", sp[0])
team, _, _ := m.mc.Client.GetTeamByName(sp[0], "")
if team == nil {
return "", "", fmt.Errorf("cannot join channel (+i)")
}
+ logger.Infof("Haw team: %s", team.Id)
teamID = team.Id
channelName = sp[1]
+ logger.Infof("Haw sp1: %s", sp[1])
}
if teamID == "" {
teamID = m.mc.Team.ID
+ logger.Infof("Haw teamid here somehow: %s", teamID)
}
+ logger.Infof("Haw channelName: %s", channelName)
+ logger.Infof("Haw teamID: %s", teamID)
channelID := m.mc.GetChannelID(channelName, teamID)
+ logger.Infof("Haw channelID: %s", channelID)
err := m.mc.JoinChannel(channelID)
logger.Debugf("join channel %s, id %s, err: %v", channelName, channelID, err)
Now on trying to join, I get this:
INFO[2022-11-02T08:16:02+11:00] login succeeded
INFO[2022-11-02T08:16:34+11:00] Haw teamid here somehow: sqmc4sz45prypmkfctwynm5yjr
INFO[2022-11-02T08:16:34+11:00] Haw channelName: matterircd
INFO[2022-11-02T08:16:34+11:00] Haw teamID: sqmc4sz45prypmkfctwynm5yjr
INFO[2022-11-02T08:16:34+11:00] Haw channelID:
ERRO[2022-11-02T08:16:34+11:00] Cannot join channel matterircd, id , err: cannot join channel (+i) module=matterircd
Even with team name it's failing:
INFO[2022-11-02T08:21:18+11:00] Haw sp0: canonical
INFO[2022-11-02T08:21:18+11:00] Haw team: sqmc4sz45prypmkfctwynm5yjr
INFO[2022-11-02T08:21:18+11:00] Haw sp1: matterircd
INFO[2022-11-02T08:21:18+11:00] Haw channelName: matterircd
INFO[2022-11-02T08:21:18+11:00] Haw teamID: sqmc4sz45prypmkfctwynm5yjr
INFO[2022-11-02T08:21:18+11:00] Haw channelID:
ERRO[2022-11-02T08:21:19+11:00] Cannot join channel canonical/matterircd, id , err: cannot join channel (+i) module=matterircd
from matterircd.
Cowboying out channelID as follows:
channelID = "uw577mmmgfbtjg9i6bz9wk97or"
logger.Infof("Haw channelID: %s", channelID)
err := m.mc.JoinChannel(channelID)
Works.
from matterircd.
The issue is with m.mc.JoinChannel(channelID)
where adding logging output (vendor/github.com/matterbridge/matterclient/channels.go
) shows only the first 357 channels returned and used for comparison.
from matterircd.
Maybe rather than loop through list of all channels, use the Mattermost API GetChannelByNameForTeamNameRoute
/ https://api.mattermost.com/#tag/channels/operation/GetChannelByName ?
from matterircd.
@kot0dama , try this patch in #487
from matterircd.
Maybe rather than loop through list of all channels, use the Mattermost API
GetChannelByNameForTeamNameRoute
/ https://api.mattermost.com/#tag/channels/operation/GetChannelByName ?
It's probably done this way so we have a cache instead of sending too many requests to mattermost.
We do ask for 5000 channels though
mmchannels, resp, err = m.Client.GetPublicChannelsForTeam(teamID, 0, 5000, "")
from matterircd.
I think this is a server side issue then:
$ curl -s -q -H 'Authorization: Bearer ...' "https://chat.myserver.local/api/v4/teams/sqmc.../channels?page=0&per_page=5000&include_total_count=true" | jq '.[]' | grep '"id":' | wc -l
200
$ curl -s -q -H 'Authorization: Bearer ...' "https://chat.myserver.local/api/v4/teams/sqmc.../channels?page=0&per_page=10&include_total_count=true" | jq '.[]' | grep '"id":' | wc -l
10
With that query directly via the API, I only get 200 results returned.
This is with MM 6.6.0.
I think the workaround of using GetChannelByName is needed here rather than get all available channels and try walk through? With GetChannelbyName, we're also able to join private channels.
from matterircd.
Or perhaps use the cache and fall back? So:
for _, t := range m.OtherTeams {
if t.ID == teamID {
for _, channel := range append(t.Channels, t.MoreChannels...) {
if getNormalisedName(channel) == name {
return channel.Id
}
}
}
}
// Fallback if it's not found in the t.Channels or t.MoreChannels cache.
channel, resp, err := m.Client.GetChannelByName(name, teamID, "")
if err != nil || resp == nil {
return ""
}
return channel.Id
from matterircd.
Upstream change - 42wim/matterbridge#1909
We can re-vendor these changes if/when it's accepted in matterbridge upstream.
from matterircd.
Maybe similar upstream bug mattermost/mattermost#20810. But its old, I'll file a new one tomorrow.
from matterircd.
Here too https://forum.mattermost.com/t/solved-how-to-increase-the-maximum-page-size-of-request/4476/3
from matterircd.
https://github.com/mattermost/mattermost-server/blob/master/web/params.go#L17
const (
PageDefault = 0
PerPageDefault = 60
PerPageMaximum = 200
LogsPerPageDefault = 10000
LogsPerPageMaximum = 10000
LimitDefault = 60
LimitMaximum = 200
)
I think I got 357 channels earlier was because it combines both:
for _, t := range m.OtherTeams {
for _, channel := range append(t.Channels, t.MoreChannels...) {
That's Channels and MoreChannels.
from matterircd.
Thanks for digging in this @hloeung
from matterircd.
Related Issues (20)
- Unable to connect with irssi HOT 1
- [wishlist] Differentiate between public and private channels HOT 9
- Reduce frequency of UpdateChannelsTeam() calls HOT 7
- Protocol error, PRIVMSG missing semicolon for empty lines HOT 1
- Limit replayed messages HOT 3
- bug(mattermost): nil pointer during SSO login HOT 3
- Segmentation fault on login HOT 7
- MatterIRD and Tailscale issues HOT 2
- Support for Mattermost 8 HOT 3
- Slack: RTM Error - received unmapped event msg=invalid_auth code=401 HOT 3
- Need new release with Mattermost 9 support HOT 3
- Matterircd ignores server on login when DefaultServer is set in configuration HOT 1
- Matterircd adds mentions for all messages including join/parts when there is no words that trigger mentions HOT 2
- Allow to part channels through a service with PartFake option HOT 1
- Can't connect to opensource.eff.org HOT 8
- Receiving files on DM creates a channel HOT 3
- DM messages from Web client show up as DMs from myself or not showing at all. HOT 6
- Add support for message attachments
- Mattermost command examples HOT 3
- on slack i cant join to private channels
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from matterircd.