MM-10597 Improved handling of punctuation around notifications (#8901)

Этот коммит содержится в:
Harrison Healey
2018-06-05 13:34:21 -04:00
коммит произвёл Carlos Tadeu Panato Junior
родитель 5e36cbae09
Коммит bca7339e4c
2 изменённых файлов: 60 добавлений и 15 удалений

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

@@ -148,14 +148,58 @@ func TestGetExplicitMentions(t *testing.T) {
OtherPotentialMentions: []string{"user"},
},
},
"OnePersonWithColonAtEnd": {
Message: "this is a message for @user:",
Keywords: map[string][]string{"this": {id1}},
"OnePersonWithPeriodAfter": {
Message: "this is a message for @user.",
Keywords: map[string][]string{"@user": {id1}},
Expected: &ExplicitMentions{
MentionedUserIds: map[string]bool{
id1: true,
},
},
},
"OnePersonWithPeriodBefore": {
Message: "this is a message for .@user",
Keywords: map[string][]string{"@user": {id1}},
Expected: &ExplicitMentions{
MentionedUserIds: map[string]bool{
id1: true,
},
},
},
"OnePersonWithColonAfter": {
Message: "this is a message for @user:",
Keywords: map[string][]string{"@user": {id1}},
Expected: &ExplicitMentions{
MentionedUserIds: map[string]bool{
id1: true,
},
},
},
"OnePersonWithColonBefore": {
Message: "this is a message for :@user",
Keywords: map[string][]string{"@user": {id1}},
Expected: &ExplicitMentions{
MentionedUserIds: map[string]bool{
id1: true,
},
},
},
"OnePersonWithHyphenAfter": {
Message: "this is a message for @user.",
Keywords: map[string][]string{"@user": {id1}},
Expected: &ExplicitMentions{
MentionedUserIds: map[string]bool{
id1: true,
},
},
},
"OnePersonWithHyphenBefore": {
Message: "this is a message for -@user",
Keywords: map[string][]string{"@user": {id1}},
Expected: &ExplicitMentions{
MentionedUserIds: map[string]bool{
id1: true,
},
OtherPotentialMentions: []string{"user"},
},
},
"MultiplePeopleWithOneWord": {
@@ -493,7 +537,7 @@ func TestGetExplicitMentionsAtHere(t *testing.T) {
"(@here(": true,
")@here)": true,
"-@here-": true,
"_@here_": false, // This case shouldn't mention since it would be mentioning "@here_"
"_@here_": true,
"=@here=": true,
"+@here+": true,
"[@here[": true,