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

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

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

Loading…
Cancel
Save