pull/1532/head
AndrewZuo01 2 years ago
parent aa39d60ccf
commit 998ef5e10d

@ -16,6 +16,8 @@ package friend
import (
"context"
"github.com/OpenIMSDK/protocol/wrapperspb"
"strconv"
"github.com/OpenIMSDK/tools/tx"
@ -407,6 +409,10 @@ func (s *friendServer) GetSpecifiedFriendsInfo(ctx context.Context, req *pbfrien
}
var friendInfo *sdkws.FriendInfo
if friend := friendMap[userID]; friend != nil {
var isPinnedBool bool
if friend.IsPinned != nil {
isPinnedBool, _ = strconv.ParseBool(*friend.IsPinned) // ignoring error for simplicity
}
friendInfo = &sdkws.FriendInfo{
OwnerUserID: friend.OwnerUserID,
Remark: friend.Remark,
@ -414,6 +420,7 @@ func (s *friendServer) GetSpecifiedFriendsInfo(ctx context.Context, req *pbfrien
AddSource: friend.AddSource,
OperatorUserID: friend.OperatorUserID,
Ex: friend.Ex,
IsPinned: wrapperspb.Bool(isPinnedBool),
}
}
var blackInfo *sdkws.BlackInfo

@ -30,7 +30,7 @@ type FriendModel struct {
AddSource int32 `bson:"add_source"`
OperatorUserID string `bson:"operator_user_id"`
Ex string `bson:"ex"`
isPinned string `bson:"is_pinned"`
IsPinned *string `bson:"is_pinned"`
}
// FriendModelInterface defines the operations for managing friends in MongoDB.

Loading…
Cancel
Save