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
Этот коммит содержится в:
коммит произвёл
Elias Nahum
родитель
be4b473aee
Коммит
446c6d452e
@@ -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) {
|
||||
|
||||
Ссылка в новой задаче
Block a user