Fix panic (mattermost). Closes #186

This commit is contained in:
Wim 2017-06-05 21:35:38 +02:00
parent 6a968ab82a
commit 01496cd080

View File

@ -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 {