From 17cc14a9d2351fcd0608c2a81eb32fd9fc3ec987 Mon Sep 17 00:00:00 2001 From: Wim Date: Tue, 2 Apr 2019 00:15:58 +0200 Subject: Send user_added and removed event through message channel (mattermost) --- matterclient/channels.go | 6 ++---- matterclient/matterclient.go | 7 ++++++- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'matterclient') diff --git a/matterclient/channels.go b/matterclient/channels.go index 568a20eb..0eac29f8 100644 --- a/matterclient/channels.go +++ b/matterclient/channels.go @@ -51,10 +51,8 @@ func (m *MMClient) GetChannelId(name string, teamId string) string { //nolint:go if res == name { return channel.Id } - } else { - if channel.Name == name { - return channel.Id - } + } else if channel.Name == name { + return channel.Id } } } diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index 18006c7a..f21cc068 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -216,9 +216,14 @@ func (m *MMClient) WsReceiver() { if msg.Post != nil { if msg.Text != "" || len(msg.Post.FileIds) > 0 || msg.Post.Type == "slack_attachment" { m.MessageChan <- msg + continue } } - continue + switch msg.Raw.Event { + case model.WEBSOCKET_EVENT_USER_ADDED, model.WEBSOCKET_EVENT_USER_REMOVED: + m.MessageChan <- msg + continue + } } var response model.WebSocketResponse -- cgit v1.2.3