Merge pull request #1667 from mattermost/fix-push

Fixing push notifications
Этот коммит содержится в:
Joram Wilander
2015-12-09 09:34:15 -05:00
родитель 7ead817199 20e3c568d1
Коммит 34cf264a08
5 изменённых файлов: 13 добавлений и 9 удалений

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

@@ -565,7 +565,11 @@ func sendNotificationsAndForget(c *Context, post *model.Post, team *model.Team,
msg.DeviceId = strings.TrimPrefix(session.DeviceId, "apple:") msg.DeviceId = strings.TrimPrefix(session.DeviceId, "apple:")
msg.ServerId = utils.CfgDiagnosticId msg.ServerId = utils.CfgDiagnosticId
msg.Message = profileMap[id].FirstName + " mentioned you in " + channel.DisplayName if channel.Type == model.CHANNEL_DIRECT {
msg.Message = channelName + " sent you a direct message"
} else {
msg.Message = profileMap[id].FirstName + " mentioned you in " + channelName
}
httpClient := http.Client{} httpClient := http.Client{}
request, _ := http.NewRequest("POST", *utils.Cfg.EmailSettings.PushNotificationServer+"/api/v1/send_push", strings.NewReader(msg.ToJson())) request, _ := http.NewRequest("POST", *utils.Cfg.EmailSettings.PushNotificationServer+"/api/v1/send_push", strings.NewReader(msg.ToJson()))

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

@@ -68,8 +68,8 @@
"ConnectionSecurity": "", "ConnectionSecurity": "",
"InviteSalt": "bjlSR4QqkXFBr7TP4oDzlfZmcNuH9YoS", "InviteSalt": "bjlSR4QqkXFBr7TP4oDzlfZmcNuH9YoS",
"PasswordResetSalt": "vZ4DcKyVVRlKHHJpexcuXzojkE5PZ5eL", "PasswordResetSalt": "vZ4DcKyVVRlKHHJpexcuXzojkE5PZ5eL",
"SendPushNotifications": true, "SendPushNotifications": false,
"PushNotificationServer": "https://push.mattermost.com" "PushNotificationServer": ""
}, },
"RateLimitSettings": { "RateLimitSettings": {
"EnableRateLimiter": true, "EnableRateLimiter": true,

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

@@ -68,8 +68,8 @@
"ConnectionSecurity": "", "ConnectionSecurity": "",
"InviteSalt": "bjlSR4QqkXFBr7TP4oDzlfZmcNuH9YoS", "InviteSalt": "bjlSR4QqkXFBr7TP4oDzlfZmcNuH9YoS",
"PasswordResetSalt": "vZ4DcKyVVRlKHHJpexcuXzojkE5PZ5eL", "PasswordResetSalt": "vZ4DcKyVVRlKHHJpexcuXzojkE5PZ5eL",
"SendPushNotifications": true, "SendPushNotifications": false,
"PushNotificationServer": "https://push.mattermost.com" "PushNotificationServer": ""
}, },
"RateLimitSettings": { "RateLimitSettings": {
"EnableRateLimiter": true, "EnableRateLimiter": true,

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

@@ -68,8 +68,8 @@
"ConnectionSecurity": "", "ConnectionSecurity": "",
"InviteSalt": "bjlSR4QqkXFBr7TP4oDzlfZmcNuH9YoS", "InviteSalt": "bjlSR4QqkXFBr7TP4oDzlfZmcNuH9YoS",
"PasswordResetSalt": "vZ4DcKyVVRlKHHJpexcuXzojkE5PZ5eL", "PasswordResetSalt": "vZ4DcKyVVRlKHHJpexcuXzojkE5PZ5eL",
"SendPushNotifications": true, "SendPushNotifications": false,
"PushNotificationServer": "https://push.mattermost.com" "PushNotificationServer": ""
}, },
"RateLimitSettings": { "RateLimitSettings": {
"EnableRateLimiter": true, "EnableRateLimiter": true,

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

@@ -181,12 +181,12 @@ func (o *Config) SetDefaults() {
if o.EmailSettings.SendPushNotifications == nil { if o.EmailSettings.SendPushNotifications == nil {
o.EmailSettings.SendPushNotifications = new(bool) o.EmailSettings.SendPushNotifications = new(bool)
*o.EmailSettings.SendPushNotifications = true *o.EmailSettings.SendPushNotifications = false
} }
if o.EmailSettings.PushNotificationServer == nil { if o.EmailSettings.PushNotificationServer == nil {
o.EmailSettings.PushNotificationServer = new(string) o.EmailSettings.PushNotificationServer = new(string)
*o.EmailSettings.PushNotificationServer = "https://push.mattermost.com" *o.EmailSettings.PushNotificationServer = ""
} }
} }