PLT-7502 fixing clearing of push notifications for iOS (#7429)
* PLT-7502 fixing clearing of push notificaitons for iOS * PLT-7502 fixing clearing of push notificaitons for iOS
Этот коммит содержится в:
@@ -649,10 +649,18 @@ func (a *App) sendPushNotification(post *model.Post, user *model.User, channel *
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) ClearPushNotification(userId string, channelId string) *model.AppError {
|
func (a *App) ClearPushNotification(userId string, channelId string) {
|
||||||
|
go func() {
|
||||||
|
// Sleep is to allow the read replicas a chance to fully sync
|
||||||
|
// the unread count for sending an accurate count.
|
||||||
|
// Delaying a little doesn't hurt anything and is cheaper than
|
||||||
|
// attempting to read from master.
|
||||||
|
time.Sleep(time.Second * 5)
|
||||||
|
|
||||||
sessions, err := a.getMobileAppSessions(userId)
|
sessions, err := a.getMobileAppSessions(userId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
l4g.Error(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := model.PushNotification{}
|
msg := model.PushNotification{}
|
||||||
@@ -673,8 +681,7 @@ func (a *App) ClearPushNotification(userId string, channelId string) *model.AppE
|
|||||||
tmpMessage.SetDeviceIdAndPlatform(session.DeviceId)
|
tmpMessage.SetDeviceIdAndPlatform(session.DeviceId)
|
||||||
go a.sendToPushProxy(tmpMessage, session)
|
go a.sendToPushProxy(tmpMessage, session)
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) sendToPushProxy(msg model.PushNotification, session *model.Session) {
|
func (a *App) sendToPushProxy(msg model.PushNotification, session *model.Session) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user