mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-15 00:19:24 +01:00
Fix panic (mattermost). Closes #186
This commit is contained in:
parent
6a968ab82a
commit
01496cd080
@ -288,7 +288,7 @@ func (m *MMClient) parseActionPost(rmsg *Message) {
|
||||
if m.GetUser(data.UserId) == nil {
|
||||
m.UpdateUsers()
|
||||
}
|
||||
rmsg.Username = m.GetUser(data.UserId).Username
|
||||
rmsg.Username = m.GetUserName(data.UserId)
|
||||
rmsg.Channel = m.GetChannelName(data.ChannelId)
|
||||
rmsg.Type = data.Type
|
||||
teamid, _ := rmsg.Raw.Data["team_id"].(string)
|
||||
@ -621,6 +621,14 @@ func (m *MMClient) GetUser(userId string) *model.User {
|
||||
return m.Users[userId]
|
||||
}
|
||||
|
||||
func (m *MMClient) GetUserName(userId string) string {
|
||||
user := m.GetUser(userId)
|
||||
if user != nil {
|
||||
return user.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MMClient) GetStatus(userId string) string {
|
||||
res, err := m.Client.GetStatuses()
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user