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

Этот коммит содержится в:
Joram Wilander
2018-02-02 14:46:49 -05:00
коммит произвёл Christopher Speller
родитель 07902b4c91
Коммит 70ad8abdcd

Просмотреть файл

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