This commit is contained in:
AndrewZuo01 2023-12-08 14:31:22 +08:00
parent aa39d60ccf
commit 998ef5e10d
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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.