From 825622fd999f12cf51fbccc8b7c1b69e865f3cc2 Mon Sep 17 00:00:00 2001 From: WangchuXiao Date: Thu, 10 Aug 2023 20:25:54 +0800 Subject: [PATCH] Fix add friend (#845) * new feature: add batch send msg * new feature: add batch send msg * new feature: add batch send msg * new feature: add batch send msg * new feature: add batch send msg * new feature: add batch send msg * fix bug: multiple gateway kick user * fix bug: multiple gateway kick user * fix bug: multiple gateway kick user * fix bug: multiple gateway kick user * fix bug: multiple gateway kick user * MsgDestructTime * fix bug: msg destruct sql * fix bug: msg destruct * fix bug: msg destruct * fix bug: msg destruct sql * fix bug: msg destruct sql * fix bug: msg destruct sql * fix bug: msg destruct sql * debug: print stack * debug: print stack * debug: print stack * fix bug: msg destruct sql Signed-off-by: wangchuxiao * fix bug: msg notification self 2 self push twice * fix bug: heartbeat get self notification * fix bug: init grpc conn in one process * fix bug: grpc conn Signed-off-by: wangchuxiao * fix bug: zk client recreate node when reconn * fix bug: set friend mark args error * fix bug: rpc client intercepter called twice Signed-off-by: wangchuxiao * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * test: document msg num set 100 * new feat: sync designated model * new feat: sync designated model * new feat: sync designated model * new feat: sync designated model * new feat: sync designated model * new feat: sync designated model * new feat: sync designated model * merge code * merge code * fix bug: repeat add friend not effect * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix bug: refused friend * fix bug: fix_add_friend * fix bug: fix_add_friend * fix bug: fix_add_friend * fix bug: fix_add_friend --------- Signed-off-by: wangchuxiao Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: wangchuxiao-dev --- internal/rpc/user/user.go | 8 +++++--- internal/tools/msg_doc_convert.go | 3 ++- pkg/common/db/relation/friend_request_model.go | 11 +++++------ pkg/common/db/unrelation/msg_convert.go | 3 ++- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index 3d954cd9a..10580798a 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -20,14 +20,17 @@ import ( "strings" "time" - "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify" - "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation" "github.com/OpenIMSDK/protocol/constant" "github.com/OpenIMSDK/protocol/sdkws" "github.com/OpenIMSDK/tools/errs" "github.com/OpenIMSDK/tools/log" "github.com/OpenIMSDK/tools/tx" + "github.com/OpenIMSDK/Open-IM-Server/pkg/authverify" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation" + + registry "github.com/OpenIMSDK/tools/discoveryregistry" + "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/convert" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/cache" @@ -36,7 +39,6 @@ import ( tablerelation "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation" "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient" "github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient/notification" - registry "github.com/OpenIMSDK/tools/discoveryregistry" pbuser "github.com/OpenIMSDK/protocol/user" "github.com/OpenIMSDK/tools/utils" diff --git a/internal/tools/msg_doc_convert.go b/internal/tools/msg_doc_convert.go index 537b7bf2c..598d0dbcf 100644 --- a/internal/tools/msg_doc_convert.go +++ b/internal/tools/msg_doc_convert.go @@ -1,10 +1,11 @@ package tools import ( - "github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor" "github.com/OpenIMSDK/protocol/constant" "github.com/OpenIMSDK/tools/log" "github.com/OpenIMSDK/tools/mcontext" + + "github.com/OpenIMSDK/Open-IM-Server/pkg/msgprocessor" ) func (c *MsgTool) ConvertTools() { diff --git a/pkg/common/db/relation/friend_request_model.go b/pkg/common/db/relation/friend_request_model.go index 7a1f98715..689b31668 100644 --- a/pkg/common/db/relation/friend_request_model.go +++ b/pkg/common/db/relation/friend_request_model.go @@ -71,14 +71,13 @@ func (f *FriendRequestGorm) UpdateByMap( // 更新记录 (非零值). func (f *FriendRequestGorm) Update(ctx context.Context, friendRequest *relation.FriendRequestModel) (err error) { - fromUserID := friendRequest.FromUserID - toUserID := friendRequest.ToUserID - friendRequest.FromUserID = "" - friendRequest.ToUserID = "" + fr2 := *friendRequest + fr2.FromUserID = "" + fr2.ToUserID = "" return utils.Wrap( f.db(ctx). - Where("from_user_id = ? AND to_user_id =?", fromUserID, toUserID). - Updates(friendRequest). + Where("from_user_id = ? AND to_user_id =?", friendRequest.FromUserID, friendRequest.ToUserID). + Updates(fr2). Error, "", ) diff --git a/pkg/common/db/unrelation/msg_convert.go b/pkg/common/db/unrelation/msg_convert.go index 134020dfd..8fbcd56e5 100644 --- a/pkg/common/db/unrelation/msg_convert.go +++ b/pkg/common/db/unrelation/msg_convert.go @@ -4,10 +4,11 @@ import ( "context" "fmt" - table "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation" "github.com/OpenIMSDK/tools/log" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" + + table "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation" ) func (m *MsgMongoDriver) ConvertMsgsDocLen(ctx context.Context, conversationIDs []string) {