PLT-1369 send core message
Этот коммит содержится в:
25
api/post.go
25
api/post.go
@@ -561,11 +561,34 @@ func sendNotificationsAndForget(c *Context, post *model.Post, team *model.Team,
|
|||||||
|
|
||||||
msg := model.PushNotification{}
|
msg := model.PushNotification{}
|
||||||
msg.Platform = model.PUSH_NOTIFY_APPLE
|
msg.Platform = model.PUSH_NOTIFY_APPLE
|
||||||
msg.Message = subjectPage.Render()
|
|
||||||
msg.Badge = 1
|
msg.Badge = 1
|
||||||
msg.DeviceId = strings.TrimPrefix(session.DeviceId, "apple:")
|
msg.DeviceId = strings.TrimPrefix(session.DeviceId, "apple:")
|
||||||
msg.ServerId = utils.CfgDiagnosticId
|
msg.ServerId = utils.CfgDiagnosticId
|
||||||
|
|
||||||
|
if len(post.Message) == 0 {
|
||||||
|
|
||||||
|
otherFile := true
|
||||||
|
|
||||||
|
if len(post.Filenames) != 0 {
|
||||||
|
for _, filename := range post.Filenames {
|
||||||
|
ext := filepath.Ext(filename)
|
||||||
|
if model.IsFileExtImage(ext) {
|
||||||
|
otherFile = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if otherFile {
|
||||||
|
msg.Message = profileMap[id].FirstName + " uploaded a file in " + channel.DisplayName
|
||||||
|
} else {
|
||||||
|
msg.Message = profileMap[id].FirstName + " uploaded an image in " + channel.DisplayName
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
msg.Message = profileMap[id].FirstName + " wrote in " + channel.DisplayName
|
||||||
|
}
|
||||||
|
|
||||||
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()))
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user