summaryrefslogtreecommitdiffstats
path: root/models/user_test.go
diff options
context:
space:
mode:
author赵智超 <1012112796@qq.com>2020-09-09 21:08:55 +0200
committerGitHub <noreply@github.com>2020-09-09 21:08:55 +0200
commitffa12bdb71d1e708ff782fb681895aea9b83766b (patch)
tree52631f50e83c2e0b5db67d3bb5df3be437bb7f31 /models/user_test.go
parent[skip ci] Updated translations via Crowdin (diff)
downloadforgejo-ffa12bdb71d1e708ff782fb681895aea9b83766b.tar.xz
forgejo-ffa12bdb71d1e708ff782fb681895aea9b83766b.zip
Fix "only mail on mention" bug (#12775)
* fix mail mention bug fix #12774 Signed-off-by: a1012112796 <1012112796@qq.com> * fix test Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'models/user_test.go')
-rw-r--r--models/user_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/models/user_test.go b/models/user_test.go
index 220823ee02..d03ef4fad4 100644
--- a/models/user_test.go
+++ b/models/user_test.go
@@ -389,3 +389,20 @@ func TestGetUserIDsByNames(t *testing.T) {
assert.Error(t, err)
assert.Equal(t, []int64(nil), IDs)
}
+
+func TestGetMaileableUsersByIDs(t *testing.T) {
+ results, err := GetMaileableUsersByIDs([]int64{1, 4}, false)
+ assert.NoError(t, err)
+ assert.Equal(t, 1, len(results))
+ if len(results) > 1 {
+ assert.Equal(t, results[0].ID, 1)
+ }
+
+ results, err = GetMaileableUsersByIDs([]int64{1, 4}, true)
+ assert.NoError(t, err)
+ assert.Equal(t, 2, len(results))
+ if len(results) > 2 {
+ assert.Equal(t, results[0].ID, 1)
+ assert.Equal(t, results[1].ID, 4)
+ }
+}