From 1fe6e7876eb4f532c06765679b56e05da369645c Mon Sep 17 00:00:00 2001 From: Gordon <46924906+FGadvancer@users.noreply.github.com> Date: Tue, 19 Sep 2023 10:17:51 +0800 Subject: [PATCH] refactor: rename get user info from cache. (#334) * fix: repeated trigger conversation changed. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: group dismissed trigger to UI. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * fix: get group member list order by join time asc. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> * refactor: rename get user info from cache. Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> --------- Signed-off-by: Gordon <46924906+FGadvancer@users.noreply.github.com> --- internal/full/open_im_sdk_full.go | 6 +++--- open_im_sdk/user.go | 4 ++-- pkg/server_api_params/public_struct.go | 2 +- wasm/cmd/main.go | 2 +- wasm/wasm_wrapper/wasm_user.go | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/full/open_im_sdk_full.go b/internal/full/open_im_sdk_full.go index 08b40a08b..0ddd6e967 100644 --- a/internal/full/open_im_sdk_full.go +++ b/internal/full/open_im_sdk_full.go @@ -88,7 +88,7 @@ func (u *Full) GetUsersInfo(ctx context.Context, userIDs []string) ([]*api.FullU return res, nil } -func (u *Full) GetUsersInfoStranger(ctx context.Context, userIDs []string, groupID string) ([]*api.FullUserInfoStranger, error) { +func (u *Full) GetUsersInfoWithCache(ctx context.Context, userIDs []string, groupID string) ([]*api.FullUserInfoWithCache, error) { friendList, err := u.db.GetFriendInfoList(ctx, userIDs) if err != nil { return nil, err @@ -164,13 +164,13 @@ func (u *Full) GetUsersInfoStranger(ctx context.Context, userIDs []string, group CreateTime: info.CreateTime, } } - res := make([]*api.FullUserInfoStranger, 0, len(users)) + res := make([]*api.FullUserInfoWithCache, 0, len(users)) for _, userID := range userIDs { info, ok := userMap[userID] if !ok { continue } - res = append(res, &api.FullUserInfoStranger{ + res = append(res, &api.FullUserInfoWithCache{ PublicInfo: info, FriendInfo: friendMap[userID], BlackInfo: blackMap[userID], diff --git a/open_im_sdk/user.go b/open_im_sdk/user.go index 427972a32..93ede6f4f 100644 --- a/open_im_sdk/user.go +++ b/open_im_sdk/user.go @@ -22,8 +22,8 @@ func GetUsersInfo(callback open_im_sdk_callback.Base, operationID string, userID call(callback, operationID, UserForSDK.Full().GetUsersInfo, userIDs) } -func GetUsersInfoStranger(callback open_im_sdk_callback.Base, operationID string, userIDs, groupID string) { - call(callback, operationID, UserForSDK.Full().GetUsersInfoStranger, userIDs, groupID) +func GetUsersInfoWithCache(callback open_im_sdk_callback.Base, operationID string, userIDs, groupID string) { + call(callback, operationID, UserForSDK.Full().GetUsersInfoWithCache, userIDs, groupID) } // GetUsersInfoFromSrv obtains the information about multiple users. diff --git a/pkg/server_api_params/public_struct.go b/pkg/server_api_params/public_struct.go index ca8f799cb..9c046c0bf 100644 --- a/pkg/server_api_params/public_struct.go +++ b/pkg/server_api_params/public_struct.go @@ -45,7 +45,7 @@ type FullUserInfo struct { BlackInfo *model_struct.LocalBlack `json:"blackInfo"` } -type FullUserInfoStranger struct { +type FullUserInfoWithCache struct { PublicInfo *PublicUser `json:"publicInfo"` FriendInfo *model_struct.LocalFriend `json:"friendInfo"` BlackInfo *model_struct.LocalBlack `json:"blackInfo"` diff --git a/wasm/cmd/main.go b/wasm/cmd/main.go index 70c9d1928..f3b7c5d57 100644 --- a/wasm/cmd/main.go +++ b/wasm/cmd/main.go @@ -157,7 +157,7 @@ func registerFunc() { js.Global().Set("getSelfUserInfo", js.FuncOf(wrapperUser.GetSelfUserInfo)) js.Global().Set("setSelfInfo", js.FuncOf(wrapperUser.SetSelfInfo)) js.Global().Set("getUsersInfo", js.FuncOf(wrapperUser.GetUsersInfo)) - js.Global().Set("getUsersInfoStranger", js.FuncOf(wrapperUser.GetUsersInfoStranger)) + js.Global().Set("getUsersInfoWithCache", js.FuncOf(wrapperUser.GetUsersInfoWithCache)) js.Global().Set("subscribeUsersStatus", js.FuncOf(wrapperUser.SubscribeUsersStatus)) js.Global().Set("unsubscribeUsersStatus", js.FuncOf(wrapperUser.UnsubscribeUsersStatus)) js.Global().Set("getSubscribeUsersStatus", js.FuncOf(wrapperUser.GetSubscribeUsersStatus)) diff --git a/wasm/wasm_wrapper/wasm_user.go b/wasm/wasm_wrapper/wasm_user.go index df0d7131c..17330de8f 100644 --- a/wasm/wasm_wrapper/wasm_user.go +++ b/wasm/wasm_wrapper/wasm_user.go @@ -48,9 +48,9 @@ func (w *WrapperUser) GetUsersInfo(_ js.Value, args []js.Value) interface{} { return event_listener.NewCaller(open_im_sdk.GetUsersInfo, callback, &args).AsyncCallWithCallback() } -func (w *WrapperUser) GetUsersInfoStranger(_ js.Value, args []js.Value) interface{} { +func (w *WrapperUser) GetUsersInfoWithCache(_ js.Value, args []js.Value) interface{} { callback := event_listener.NewBaseCallback(utils.FirstLower(utils.GetSelfFuncName()), w.commonFunc) - return event_listener.NewCaller(open_im_sdk.GetUsersInfoStranger, callback, &args).AsyncCallWithCallback() + return event_listener.NewCaller(open_im_sdk.GetUsersInfoWithCache, callback, &args).AsyncCallWithCallback() } func (w *WrapperUser) SubscribeUsersStatus(_ js.Value, args []js.Value) interface{} {