[MM-17155] Changes to email notifications to support Deep Linking page (#13362)

* Change link to redirect email notifications to landing page

* Fix to undefined variable

* Change `vault` to `landing`

* Added a couple tests

Co-authored-by: David Meza <dmeza@users.noreply.github.com>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Devin Binnie
2020-01-13 16:24:28 -05:00
коммит произвёл GitHub
родитель ed555faa75
Коммит 8e2c59ca00
2 изменённых файлов: 53 добавлений и 6 удалений

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

@@ -586,3 +586,50 @@ func TestGenerateHyperlinkForChannelsPrivate(t *testing.T) {
outMessage := th.App.generateHyperlinkForChannels(message, teamName, teamURL)
assert.Equal(t, message, outMessage)
}
func TestLandingLink(t *testing.T) {
th := Setup(t)
defer th.TearDown()
recipient := &model.User{}
post := &model.Post{
Message: "This is the message",
}
channel := &model.Channel{
DisplayName: "ChannelName",
Type: model.CHANNEL_OPEN,
}
channelName := "ChannelName"
senderName := "sender"
teamName := "select_team"
teamURL := "http://localhost:8065/landing#/" + teamName
emailNotificationContentsType := model.EMAIL_NOTIFICATION_CONTENTS_FULL
translateFunc := utils.GetUserTranslations("en")
body := th.App.getNotificationEmailBody(recipient, post, channel, channelName, senderName, teamName, teamURL, emailNotificationContentsType, true, translateFunc)
require.Contains(t, body, teamURL, fmt.Sprintf("Expected email text '%s'. Got %s", teamURL, body))
}
func TestLandingLinkPermalink(t *testing.T) {
th := Setup(t)
defer th.TearDown()
recipient := &model.User{}
post := &model.Post{
Id: "Test_id",
Message: "This is the message",
}
channel := &model.Channel{
DisplayName: "ChannelName",
Type: model.CHANNEL_OPEN,
}
channelName := "ChannelName"
senderName := "sender"
teamName := "team"
teamURL := "http://localhost:8065/landing#/" + teamName
emailNotificationContentsType := model.EMAIL_NOTIFICATION_CONTENTS_FULL
translateFunc := utils.GetUserTranslations("en")
body := th.App.getNotificationEmailBody(recipient, post, channel, channelName, senderName, teamName, teamURL, emailNotificationContentsType, true, translateFunc)
require.Contains(t, body, teamURL+"/pl/"+post.Id, fmt.Sprintf("Expected email text '%s'. Got %s", teamURL, body))
}