PLT-3462 Add the ability to clear push notifications after channel is viewed (#3834)

* Add the ability to clear push notifications after channel is viewed

* Fix race condition between updating the mention count and reading it when sending push notifications
Этот коммит содержится в:
Joram Wilander
2016-08-31 12:52:14 -04:00
коммит произвёл GitHub
родитель b0b39ce71c
Коммит 26f96b240d
8 изменённых файлов: 181 добавлений и 70 удалений

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

@@ -6,6 +6,7 @@ package model
import (
"encoding/json"
"io"
"strings"
)
const (
@@ -109,6 +110,11 @@ func (me *Session) GetTeamByTeamId(teamId string) *TeamMember {
return nil
}
func (me *Session) IsMobileApp() bool {
return len(me.DeviceId) > 0 &&
(strings.HasPrefix(me.DeviceId, PUSH_NOTIFY_APPLE+":") || strings.HasPrefix(me.DeviceId, PUSH_NOTIFY_ANDROID+":"))
}
func SessionsToJson(o []*Session) string {
if b, err := json.Marshal(o); err != nil {
return "[]"