mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-08 11:05:59 +08:00
fix: fix all lint warning in pkg (#1263)
* fix:fix lint errors in internal * fix:fix lint error in interal/tools * fix: fix lint errros in pkg/statics * fix: fix lint erros in pkg/authverify,pkg/rpcclien * fix: fix lint erros in pkg/common/cmd * fix: fix lint erros in pkg/common/config,convert * fix: fix lint erros in pkg/common/db/cache * fix: fix lint errors in pkg/common/db/controller * fix:fix lint errors in pkg/common/db/relation and pkg/common/db/localcache * fix: fix rest lint errors in pkg/common/db * fix: fix rest lint errors in pkg * fix:set back go.work to use go 1.19
This commit is contained in:
@@ -52,6 +52,7 @@ func WithUserFunc(
|
||||
for _, user := range users {
|
||||
result = append(result, user)
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
u.getUsersInfo = f
|
||||
@@ -68,34 +69,37 @@ func NewUserNotificationSender(
|
||||
for _, opt := range opts {
|
||||
opt(f)
|
||||
}
|
||||
|
||||
return f
|
||||
}
|
||||
|
||||
func (u *UserNotificationSender) getUsersInfoMap(
|
||||
ctx context.Context,
|
||||
userIDs []string,
|
||||
) (map[string]*sdkws.UserInfo, error) {
|
||||
users, err := u.getUsersInfo(ctx, userIDs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result := make(map[string]*sdkws.UserInfo)
|
||||
for _, user := range users {
|
||||
result[user.GetUserID()] = user.(*sdkws.UserInfo)
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
// func (u *UserNotificationSender) getUsersInfoMap(
|
||||
// ctx context.Context,
|
||||
// userIDs []string,
|
||||
// ) (map[string]*sdkws.UserInfo, error) {
|
||||
// users, err := u.getUsersInfo(ctx, userIDs)
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// result := make(map[string]*sdkws.UserInfo)
|
||||
// for _, user := range users {
|
||||
// result[user.GetUserID()] = user.(*sdkws.UserInfo)
|
||||
// }
|
||||
|
||||
func (u *UserNotificationSender) getFromToUserNickname(
|
||||
ctx context.Context,
|
||||
fromUserID, toUserID string,
|
||||
) (string, string, error) {
|
||||
users, err := u.getUsersInfoMap(ctx, []string{fromUserID, toUserID})
|
||||
if err != nil {
|
||||
return "", "", nil
|
||||
}
|
||||
return users[fromUserID].Nickname, users[toUserID].Nickname, nil
|
||||
}
|
||||
// return result, nil
|
||||
// }
|
||||
|
||||
// func (u *UserNotificationSender) getFromToUserNickname(
|
||||
// ctx context.Context,
|
||||
// fromUserID, toUserID string,
|
||||
// ) (string, string, error) {
|
||||
// users, err := u.getUsersInfoMap(ctx, []string{fromUserID, toUserID})
|
||||
// if err != nil {
|
||||
// return "", "", err
|
||||
// }
|
||||
|
||||
// return users[fromUserID].Nickname, users[toUserID].Nickname, nil
|
||||
// }
|
||||
|
||||
func (u *UserNotificationSender) UserStatusChangeNotification(
|
||||
ctx context.Context,
|
||||
|
||||
Reference in New Issue
Block a user