PLT-7509 Stopped processing special mentions for change of header/purpose messages (#7410)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
2be5577b88
Коммит
2a6cd44f23
@@ -420,7 +420,7 @@ func TestGetMentionKeywords(t *testing.T) {
|
||||
}
|
||||
|
||||
profiles := map[string]*model.User{user1.Id: user1}
|
||||
mentions := GetMentionKeywordsInChannel(profiles)
|
||||
mentions := GetMentionKeywordsInChannel(profiles, true)
|
||||
if len(mentions) != 3 {
|
||||
t.Fatal("should've returned three mention keywords")
|
||||
} else if ids, ok := mentions["user"]; !ok || ids[0] != user1.Id {
|
||||
@@ -442,7 +442,7 @@ func TestGetMentionKeywords(t *testing.T) {
|
||||
}
|
||||
|
||||
profiles = map[string]*model.User{user2.Id: user2}
|
||||
mentions = GetMentionKeywordsInChannel(profiles)
|
||||
mentions = GetMentionKeywordsInChannel(profiles, true)
|
||||
if len(mentions) != 2 {
|
||||
t.Fatal("should've returned two mention keyword")
|
||||
} else if ids, ok := mentions["First"]; !ok || ids[0] != user2.Id {
|
||||
@@ -460,7 +460,7 @@ func TestGetMentionKeywords(t *testing.T) {
|
||||
}
|
||||
|
||||
profiles = map[string]*model.User{user3.Id: user3}
|
||||
mentions = GetMentionKeywordsInChannel(profiles)
|
||||
mentions = GetMentionKeywordsInChannel(profiles, true)
|
||||
if len(mentions) != 3 {
|
||||
t.Fatal("should've returned three mention keywords")
|
||||
} else if ids, ok := mentions["@channel"]; !ok || ids[0] != user3.Id {
|
||||
@@ -482,7 +482,7 @@ func TestGetMentionKeywords(t *testing.T) {
|
||||
}
|
||||
|
||||
profiles = map[string]*model.User{user4.Id: user4}
|
||||
mentions = GetMentionKeywordsInChannel(profiles)
|
||||
mentions = GetMentionKeywordsInChannel(profiles, true)
|
||||
if len(mentions) != 6 {
|
||||
t.Fatal("should've returned six mention keywords")
|
||||
} else if ids, ok := mentions["user"]; !ok || ids[0] != user4.Id {
|
||||
@@ -524,7 +524,7 @@ func TestGetMentionKeywords(t *testing.T) {
|
||||
user3.Id: user3,
|
||||
user4.Id: user4,
|
||||
}
|
||||
mentions = GetMentionKeywordsInChannel(profiles)
|
||||
mentions = GetMentionKeywordsInChannel(profiles, true)
|
||||
if len(mentions) != 6 {
|
||||
t.Fatal("should've returned six mention keywords")
|
||||
} else if ids, ok := mentions["user"]; !ok || len(ids) != 2 || (ids[0] != user1.Id && ids[1] != user1.Id) || (ids[0] != user4.Id && ids[1] != user4.Id) {
|
||||
@@ -534,12 +534,35 @@ func TestGetMentionKeywords(t *testing.T) {
|
||||
} else if ids, ok := mentions["mention"]; !ok || len(ids) != 2 || (ids[0] != user1.Id && ids[1] != user1.Id) || (ids[0] != user4.Id && ids[1] != user4.Id) {
|
||||
t.Fatal("should've mentioned user1 and user4 with mention")
|
||||
} else if ids, ok := mentions["First"]; !ok || len(ids) != 2 || (ids[0] != user2.Id && ids[1] != user2.Id) || (ids[0] != user4.Id && ids[1] != user4.Id) {
|
||||
t.Fatal("should've mentioned user2 and user4 with mention")
|
||||
t.Fatal("should've mentioned user2 and user4 with First")
|
||||
} else if ids, ok := mentions["@channel"]; !ok || len(ids) != 2 || (ids[0] != user3.Id && ids[1] != user3.Id) || (ids[0] != user4.Id && ids[1] != user4.Id) {
|
||||
t.Fatal("should've mentioned user3 and user4 with @channel")
|
||||
} else if ids, ok := mentions["@all"]; !ok || len(ids) != 2 || (ids[0] != user3.Id && ids[1] != user3.Id) || (ids[0] != user4.Id && ids[1] != user4.Id) {
|
||||
t.Fatal("should've mentioned user3 and user4 with @all")
|
||||
}
|
||||
|
||||
// no special mentions
|
||||
profiles = map[string]*model.User{
|
||||
user1.Id: user1,
|
||||
}
|
||||
mentions = GetMentionKeywordsInChannel(profiles, false)
|
||||
if len(mentions) != 3 {
|
||||
t.Fatal("should've returned three mention keywords")
|
||||
} else if ids, ok := mentions["user"]; !ok || len(ids) != 1 || ids[0] != user1.Id {
|
||||
t.Fatal("should've mentioned user1 with user")
|
||||
} else if ids, ok := mentions["@user"]; !ok || len(ids) != 2 || ids[0] != user1.Id || ids[1] != user1.Id {
|
||||
t.Fatal("should've mentioned user1 twice with @user")
|
||||
} else if ids, ok := mentions["mention"]; !ok || len(ids) != 1 || ids[0] != user1.Id {
|
||||
t.Fatal("should've mentioned user1 with mention")
|
||||
} else if _, ok := mentions["First"]; ok {
|
||||
t.Fatal("should not have mentioned user1 with First")
|
||||
} else if _, ok := mentions["@channel"]; ok {
|
||||
t.Fatal("should not have mentioned any user with @channel")
|
||||
} else if _, ok := mentions["@all"]; ok {
|
||||
t.Fatal("should not have mentioned any user with @all")
|
||||
} else if _, ok := mentions["@here"]; ok {
|
||||
t.Fatal("should not have mentioned any user with @here")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDoesNotifyPropsAllowPushNotification(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user