diff options
author | 赵智超 <1012112796@qq.com> | 2020-09-09 21:08:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-09 21:08:55 +0200 |
commit | ffa12bdb71d1e708ff782fb681895aea9b83766b (patch) | |
tree | 52631f50e83c2e0b5db67d3bb5df3be437bb7f31 /models/user_test.go | |
parent | [skip ci] Updated translations via Crowdin (diff) | |
download | forgejo-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.go | 17 |
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) + } +} |