From 84983434818cbe5c50c49839e89a3a513bf8eb06 Mon Sep 17 00:00:00 2001 From: Rain Date: Sat, 4 Jan 2020 21:51:34 +0800 Subject: [PATCH] fix(notify): Fix the error of filter about contacts --- pkg/notify/cache/usercache.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pkg/notify/cache/usercache.go b/pkg/notify/cache/usercache.go index 5b4886069d..b0175174c4 100644 --- a/pkg/notify/cache/usercache.go +++ b/pkg/notify/cache/usercache.go @@ -103,13 +103,8 @@ func (ucm *SUserCacheManager) FetchUserLikeName(ctx context.Context, name string // todo return nil, fmt.Errorf("FetchUserLikeName with check Not Implement") } - q := ucm.Query().Like("name", "%"+name+"%") - users := make([]SUser, 0) - err := db.FetchModelObjects(ucm, q, &users) - if err != nil { - return nil, err - } - return users, nil + q := ucm.Query().Contains("name", name) + return ucm.FetchUserFromLoaclCache(ctx, q) } func (ucm *SUserCacheManager) FetchUserFromLoaclCache(ctx context.Context, q *sqlchemy.SQuery) ([]SUser, error) {