MM-12795: remove @ from push notifications (#10298)

* remove @ from push notifications

* prepend @ when display name is set to username

* fix @ in username

* fix username getting prefixed in push notifications
Этот коммит содержится в:
Sheshagiri Rao Mallipedhi
2019-04-23 21:50:19 +05:30
коммит произвёл Elias Nahum
родитель be4b473aee
Коммит 446c6d452e
2 изменённых файлов: 49 добавлений и 45 удалений

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

@@ -133,6 +133,10 @@ func (a *App) sendPushNotification(notification *postNotification, user *model.U
channelName := notification.GetChannelName(nameFormat, user.Id)
senderName := notification.GetSenderName(nameFormat, *cfg.ServiceSettings.EnablePostUsernameOverride)
if senderName == notification.sender.Username {
senderName = "@" + senderName
}
c := a.Srv.PushNotificationsHub.GetGoChannelFromUserId(user.Id)
c <- PushNotification{
notificationType: NOTIFICATION_TYPE_MESSAGE,
@@ -155,7 +159,7 @@ func (a *App) getPushNotificationMessage(postMessage string, explicitMention, ch
if channelType == model.CHANNEL_DIRECT {
return strings.Trim(userLocale("api.post.send_notifications_and_forget.push_image_only"), " ")
}
return "@" + senderName + userLocale("api.post.send_notifications_and_forget.push_image_only")
return senderName + userLocale("api.post.send_notifications_and_forget.push_image_only")
}
contentsConfig := *a.Config().EmailSettings.PushNotificationContents
@@ -164,7 +168,7 @@ func (a *App) getPushNotificationMessage(postMessage string, explicitMention, ch
if channelType == model.CHANNEL_DIRECT {
return model.ClearMentionTags(postMessage)
}
return "@" + senderName + ": " + model.ClearMentionTags(postMessage)
return senderName + ": " + model.ClearMentionTags(postMessage)
}
if channelType == model.CHANNEL_DIRECT {
@@ -172,22 +176,22 @@ func (a *App) getPushNotificationMessage(postMessage string, explicitMention, ch
}
if channelWideMention {
return "@" + senderName + userLocale("api.post.send_notification_and_forget.push_channel_mention")
return senderName + userLocale("api.post.send_notification_and_forget.push_channel_mention")
}
if explicitMention {
return "@" + senderName + userLocale("api.post.send_notifications_and_forget.push_explicit_mention")
return senderName + userLocale("api.post.send_notifications_and_forget.push_explicit_mention")
}
if replyToThreadType == THREAD_ROOT {
return "@" + senderName + userLocale("api.post.send_notification_and_forget.push_comment_on_post")
return senderName + userLocale("api.post.send_notification_and_forget.push_comment_on_post")
}
if replyToThreadType == THREAD_ANY {
return "@" + senderName + userLocale("api.post.send_notification_and_forget.push_comment_on_thread")
return senderName + userLocale("api.post.send_notification_and_forget.push_comment_on_thread")
}
return "@" + senderName + userLocale("api.post.send_notifications_and_forget.push_general_message")
return senderName + userLocale("api.post.send_notifications_and_forget.push_general_message")
}
func (a *App) ClearPushNotificationSync(currentSessionId, userId, channelId string) {