Skip to content

Commit

Permalink
MM-18066 Remove double @ for email notifications (mattermost#12131)
Browse files Browse the repository at this point in the history
* Remove double @ for email notifications

* Fix tests
  • Loading branch information
enahum authored Sep 11, 2019
1 parent be25dcd commit 3618947
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
32 changes: 16 additions & 16 deletions app/notification_email_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ func TestGetNotificationEmailBodyFullNotificationPublicChannel(t *testing.T) {
if !strings.Contains(body, "Channel: "+channel.DisplayName) {
t.Fatal("Expected email text 'Channel: " + channel.DisplayName + "'. Got " + body)
}
if !strings.Contains(body, "@"+senderName+" - ") {
t.Fatal("Expected email text '@" + senderName + " - '. Got " + body)
if !strings.Contains(body, senderName+" - ") {
t.Fatal("Expected email text '" + senderName + " - '. Got " + body)
}
if !strings.Contains(body, post.Message) {
t.Fatal("Expected email text '" + post.Message + "'. Got " + body)
Expand Down Expand Up @@ -146,8 +146,8 @@ func TestGetNotificationEmailBodyFullNotificationGroupChannel(t *testing.T) {
if !strings.Contains(body, "Channel: ChannelName") {
t.Fatal("Expected email text 'Channel: ChannelName'. Got " + body)
}
if !strings.Contains(body, "@"+senderName+" - ") {
t.Fatal("Expected email text '@" + senderName + " - '. Got " + body)
if !strings.Contains(body, senderName+" - ") {
t.Fatal("Expected email text '" + senderName + " - '. Got " + body)
}
if !strings.Contains(body, post.Message) {
t.Fatal("Expected email text '" + post.Message + "'. Got " + body)
Expand Down Expand Up @@ -183,8 +183,8 @@ func TestGetNotificationEmailBodyFullNotificationPrivateChannel(t *testing.T) {
if !strings.Contains(body, "Channel: "+channel.DisplayName) {
t.Fatal("Expected email text 'Channel: " + channel.DisplayName + "'. Got " + body)
}
if !strings.Contains(body, "@"+senderName+" - ") {
t.Fatal("Expected email text '@" + senderName + " - '. Got " + body)
if !strings.Contains(body, senderName+" - ") {
t.Fatal("Expected email text '" + senderName + " - '. Got " + body)
}
if !strings.Contains(body, post.Message) {
t.Fatal("Expected email text '" + post.Message + "'. Got " + body)
Expand Down Expand Up @@ -217,8 +217,8 @@ func TestGetNotificationEmailBodyFullNotificationDirectChannel(t *testing.T) {
if !strings.Contains(body, "You have a new Direct Message.") {
t.Fatal("Expected email text 'You have a new Direct Message. Got " + body)
}
if !strings.Contains(body, "@"+senderName+" - ") {
t.Fatal("Expected email text '@" + senderName + " - '. Got " + body)
if !strings.Contains(body, senderName+" - ") {
t.Fatal("Expected email text '" + senderName + " - '. Got " + body)
}
if !strings.Contains(body, post.Message) {
t.Fatal("Expected email text '" + post.Message + "'. Got " + body)
Expand Down Expand Up @@ -386,8 +386,8 @@ func TestGetNotificationEmailBodyGenericNotificationPublicChannel(t *testing.T)
translateFunc := utils.GetUserTranslations("en")

body := th.App.getNotificationEmailBody(recipient, post, channel, channelName, senderName, teamName, teamURL, emailNotificationContentsType, true, translateFunc)
if !strings.Contains(body, "You have a new notification from @"+senderName) {
t.Fatal("Expected email text 'You have a new notification from @" + senderName + "'. Got " + body)
if !strings.Contains(body, "You have a new notification from "+senderName) {
t.Fatal("Expected email text 'You have a new notification from " + senderName + "'. Got " + body)
}
if strings.Contains(body, "Channel: "+channel.DisplayName) {
t.Fatal("Did not expect email text 'Channel: " + channel.DisplayName + "'. Got " + body)
Expand Down Expand Up @@ -420,8 +420,8 @@ func TestGetNotificationEmailBodyGenericNotificationGroupChannel(t *testing.T) {
translateFunc := utils.GetUserTranslations("en")

body := th.App.getNotificationEmailBody(recipient, post, channel, channelName, senderName, teamName, teamURL, emailNotificationContentsType, true, translateFunc)
if !strings.Contains(body, "You have a new Group Message from @"+senderName) {
t.Fatal("Expected email text 'You have a new Group Message from @" + senderName + "'. Got " + body)
if !strings.Contains(body, "You have a new Group Message from "+senderName) {
t.Fatal("Expected email text 'You have a new Group Message from " + senderName + "'. Got " + body)
}
if strings.Contains(body, "CHANNEL: "+channel.DisplayName) {
t.Fatal("Did not expect email text 'CHANNEL: " + channel.DisplayName + "'. Got " + body)
Expand Down Expand Up @@ -454,8 +454,8 @@ func TestGetNotificationEmailBodyGenericNotificationPrivateChannel(t *testing.T)
translateFunc := utils.GetUserTranslations("en")

body := th.App.getNotificationEmailBody(recipient, post, channel, channelName, senderName, teamName, teamURL, emailNotificationContentsType, true, translateFunc)
if !strings.Contains(body, "You have a new notification from @"+senderName) {
t.Fatal("Expected email text 'You have a new notification from @" + senderName + "'. Got " + body)
if !strings.Contains(body, "You have a new notification from "+senderName) {
t.Fatal("Expected email text 'You have a new notification from " + senderName + "'. Got " + body)
}
if strings.Contains(body, "CHANNEL: "+channel.DisplayName) {
t.Fatal("Did not expect email text 'CHANNEL: " + channel.DisplayName + "'. Got " + body)
Expand Down Expand Up @@ -488,8 +488,8 @@ func TestGetNotificationEmailBodyGenericNotificationDirectChannel(t *testing.T)
translateFunc := utils.GetUserTranslations("en")

body := th.App.getNotificationEmailBody(recipient, post, channel, channelName, senderName, teamName, teamURL, emailNotificationContentsType, true, translateFunc)
if !strings.Contains(body, "You have a new Direct Message from @"+senderName) {
t.Fatal("Expected email text 'You have a new Direct Message from @" + senderName + "'. Got " + body)
if !strings.Contains(body, "You have a new Direct Message from "+senderName) {
t.Fatal("Expected email text 'You have a new Direct Message from " + senderName + "'. Got " + body)
}
if strings.Contains(body, "CHANNEL: "+channel.DisplayName) {
t.Fatal("Did not expect email text 'CHANNEL: " + channel.DisplayName + "'. Got " + body)
Expand Down
12 changes: 6 additions & 6 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3376,27 +3376,27 @@
},
{
"id": "app.notification.body.intro.direct.generic",
"translation": "You have a new Direct Message from @{{.SenderName}}"
"translation": "You have a new Direct Message from {{.SenderName}}"
},
{
"id": "app.notification.body.intro.group_message.full",
"translation": "You have a new Group Message."
},
{
"id": "app.notification.body.intro.group_message.generic",
"translation": "You have a new Group Message from @{{.SenderName}}"
"translation": "You have a new Group Message from {{.SenderName}}"
},
{
"id": "app.notification.body.intro.notification.full",
"translation": "You have a new notification."
},
{
"id": "app.notification.body.intro.notification.generic",
"translation": "You have a new notification from @{{.SenderName}}"
"translation": "You have a new notification from {{.SenderName}}"
},
{
"id": "app.notification.body.text.direct.full",
"translation": "@{{.SenderName}} - {{.Hour}}:{{.Minute}} {{.TimeZone}}, {{.Month}} {{.Day}}"
"translation": "{{.SenderName}} - {{.Hour}}:{{.Minute}} {{.TimeZone}}, {{.Month}} {{.Day}}"
},
{
"id": "app.notification.body.text.direct.generic",
Expand All @@ -3408,7 +3408,7 @@
},
{
"id": "app.notification.body.text.group_message.full2",
"translation": "@{{.SenderName}} - {{.Hour}}:{{.Minute}} {{.TimeZone}}, {{.Month}} {{.Day}}"
"translation": "{{.SenderName}} - {{.Hour}}:{{.Minute}} {{.TimeZone}}, {{.Month}} {{.Day}}"
},
{
"id": "app.notification.body.text.group_message.generic",
Expand All @@ -3420,7 +3420,7 @@
},
{
"id": "app.notification.body.text.notification.full2",
"translation": "@{{.SenderName}} - {{.Hour}}:{{.Minute}} {{.TimeZone}}, {{.Month}} {{.Day}}"
"translation": "{{.SenderName}} - {{.Hour}}:{{.Minute}} {{.TimeZone}}, {{.Month}} {{.Day}}"
},
{
"id": "app.notification.body.text.notification.generic",
Expand Down

0 comments on commit 3618947

Please sign in to comment.