diff --git a/go.mod b/go.mod index 6e8abd3e4..edb6a5c3a 100644 --- a/go.mod +++ b/go.mod @@ -155,4 +155,4 @@ require ( gopkg.in/ini.v1 v1.67.0 // indirect ) -replace github.com/OpenIMSDK/protocol v0.0.31 => github.com/AndrewZuo01/protocol v0.0.0-20231208060936-18be05d57a18 +replace github.com/OpenIMSDK/protocol v0.0.31 => github.com/AndrewZuo01/protocol v0.0.0-20231208073751-274bf5b7eba8 diff --git a/internal/rpc/friend/friend.go b/internal/rpc/friend/friend.go index 66d74eb12..3b42fef66 100644 --- a/internal/rpc/friend/friend.go +++ b/internal/rpc/friend/friend.go @@ -16,7 +16,6 @@ package friend import ( "context" - "github.com/OpenIMSDK/protocol/wrapperspb" "github.com/OpenIMSDK/tools/tx" "github.com/OpenIMSDK/protocol/sdkws" @@ -407,10 +406,7 @@ 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 = *friend.IsPinned // ignoring error for simplicity - } + friendInfo = &sdkws.FriendInfo{ OwnerUserID: friend.OwnerUserID, Remark: friend.Remark, @@ -418,7 +414,7 @@ func (s *friendServer) GetSpecifiedFriendsInfo(ctx context.Context, req *pbfrien AddSource: friend.AddSource, OperatorUserID: friend.OperatorUserID, Ex: friend.Ex, - IsPinned: wrapperspb.Bool(isPinnedBool), + IsPinned: friend.IsPinned, } } var blackInfo *sdkws.BlackInfo diff --git a/pkg/common/convert/friend.go b/pkg/common/convert/friend.go index 21eef9b7b..62ce6f95b 100644 --- a/pkg/common/convert/friend.go +++ b/pkg/common/convert/friend.go @@ -17,8 +17,6 @@ package convert import ( "context" "fmt" - "github.com/OpenIMSDK/protocol/wrapperspb" - "github.com/OpenIMSDK/protocol/sdkws" "github.com/OpenIMSDK/tools/utils" @@ -76,11 +74,7 @@ func FriendsDB2Pb( friendPb.FriendUser.FaceURL = users[friend.FriendUserID].FaceURL friendPb.FriendUser.Ex = users[friend.FriendUserID].Ex friendPb.CreateTime = friend.CreateTime.Unix() - if friend.IsPinned != nil { - friendPb.IsPinned = wrapperspb.Bool(*friend.IsPinned) - } else { - friendPb.IsPinned = nil - } + friendPb.IsPinned = friend.IsPinned friendsPb = append(friendsPb, friendPb) } return friendsPb, nil diff --git a/pkg/common/db/table/relation/friend.go b/pkg/common/db/table/relation/friend.go index 7d8f181a0..4f85998f4 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 *bool `bson:"is_pinned"` + IsPinned bool `bson:"is_pinned"` } // FriendModelInterface defines the operations for managing friends in MongoDB.