Fix panic when invalid types used in post props (#8191)

This commit is contained in:
Joram Wilander
2018-02-02 14:46:49 -05:00
committed by Christopher Speller
parent 07902b4c91
commit 70ad8abdcd

View File

@@ -584,16 +584,16 @@ func (a *App) sendPushNotification(post *model.Post, user *model.User, channel *
msg.ChannelName = channel.Name
msg.SenderId = post.UserId
if ou, ok := post.Props["override_username"]; ok && ou != nil {
msg.OverrideUsername = ou.(string)
if ou, ok := post.Props["override_username"].(string); ok {
msg.OverrideUsername = ou
}
if oi, ok := post.Props["override_icon_url"]; ok && oi != nil {
msg.OverrideIconUrl = oi.(string)
if oi, ok := post.Props["override_icon_url"].(string); ok {
msg.OverrideIconUrl = oi
}
if fw, ok := post.Props["from_webhook"]; ok && fw != nil {
msg.FromWebhook = fw.(string)
if fw, ok := post.Props["from_webhook"].(string); ok {
msg.FromWebhook = fw
}
if *a.Config().EmailSettings.PushNotificationContents == model.FULL_NOTIFICATION {