diff --git a/internal/rpc/friend/friend.go b/internal/rpc/friend/friend.go index 203739a3d..14b1791ad 100644 --- a/internal/rpc/friend/friend.go +++ b/internal/rpc/friend/friend.go @@ -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 diff --git a/pkg/common/db/table/relation/friend.go b/pkg/common/db/table/relation/friend.go index 216051421..72a0c0dde 100644 --- a/pkg/common/db/table/relation/friend.go +++ b/pkg/common/db/table/relation/friend.go @@ -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.