MM-14289 & MM-14884 Push notification acknowledge id and include sender name (#10736)

* MM-14289 Add Push notification acknowledge identifier and store tracing logs

* MM-14884 include SenderName property in Push Notifications

* Remove @ sign from channel Name in push notifications

* Fix i18n

* Fix push notification model

* fix TestPostNotificationGetChannelName

* Remove colon from model constant

* Fix Notification Registry tests

* Make postId optional for clear notifications

* Update http status when service is not available

Co-Authored-By: enahum <nahumhbl@gmail.com>
Этот коммит содержится в:
Elias Nahum
2019-04-30 18:15:29 -04:00
коммит произвёл GitHub
родитель e50b642e43
Коммит e6be06b3fc
18 изменённых файлов: 677 добавлений и 54 удалений

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

@@ -306,6 +306,18 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
(channelNotification || hereNotification || allNotification),
replyToThreadType,
)
} else {
// register that a notification was not sent
notificationRegistry := model.NotificationRegistry{
UserId: id,
PostId: post.Id,
SendStatus: model.PUSH_NOT_SENT,
Type: model.PUSH_TYPE_MESSAGE,
}
_, appErr := a.Srv.Store.NotificationRegistry().Save(&notificationRegistry)
if appErr != nil {
mlog.Debug(appErr.Error())
}
}
}
@@ -329,6 +341,18 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
false,
"",
)
} else {
// register that a notification was not sent
notificationRegistry := model.NotificationRegistry{
UserId: id,
PostId: post.Id,
SendStatus: model.PUSH_NOT_SENT,
Type: model.PUSH_TYPE_MESSAGE,
}
_, appErr := a.Srv.Store.NotificationRegistry().Save(&notificationRegistry)
if appErr != nil {
mlog.Debug(appErr.Error())
}
}
}
}
@@ -691,7 +715,7 @@ type postNotification struct {
func (n *postNotification) GetChannelName(userNameFormat string, excludeId string) string {
switch n.channel.Type {
case model.CHANNEL_DIRECT:
return fmt.Sprintf("@%s", n.sender.GetDisplayName(userNameFormat))
return n.sender.GetDisplayName(userNameFormat)
case model.CHANNEL_GROUP:
names := []string{}
for _, user := range n.profileMap {