Skip to content

Commit

Permalink
refactor: rename get user info from cache. (#334)
Browse files Browse the repository at this point in the history
* fix: repeated trigger conversation changed.

Signed-off-by: Gordon <[email protected]>

* fix: group dismissed trigger to UI.

Signed-off-by: Gordon <[email protected]>

* fix: get group member list order by join time asc.

Signed-off-by: Gordon <[email protected]>

* refactor: rename get user info from cache.

Signed-off-by: Gordon <[email protected]>

---------

Signed-off-by: Gordon <[email protected]>
  • Loading branch information
FGadvancer authored Sep 19, 2023
1 parent 2aec4be commit 1fe6e78
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions internal/full/open_im_sdk_full.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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],
Expand Down
4 changes: 2 additions & 2 deletions open_im_sdk/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pkg/server_api_params/public_struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
2 changes: 1 addition & 1 deletion wasm/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions wasm/wasm_wrapper/wasm_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{} {
Expand Down

0 comments on commit 1fe6e78

Please sign in to comment.