summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/notification_test.go2
-rw-r--r--utils/utils.go9
2 files changed, 10 insertions, 1 deletions
diff --git a/app/notification_test.go b/app/notification_test.go
index 24784940e..3b8b4adf5 100644
--- a/app/notification_test.go
+++ b/app/notification_test.go
@@ -37,7 +37,7 @@ func TestSendNotifications(t *testing.T) {
} else if mentions == nil {
t.Log(mentions)
t.Fatal("user should have been mentioned")
- } else if mentions[0] != th.BasicUser2.Id {
+ } else if !utils.StringInSlice(th.BasicUser2.Id, mentions) {
t.Log(mentions)
t.Fatal("user should have been mentioned")
}
diff --git a/utils/utils.go b/utils/utils.go
index 595a9d2ba..b156f9934 100644
--- a/utils/utils.go
+++ b/utils/utils.go
@@ -13,6 +13,15 @@ import (
"github.com/mattermost/mattermost-server/model"
)
+func StringInSlice(a string, slice []string) bool {
+ for _, b := range slice {
+ if b == a {
+ return true
+ }
+ }
+ return false
+}
+
func StringArrayIntersection(arr1, arr2 []string) []string {
arrMap := map[string]bool{}
result := []string{}