From 96e09a1b370e446f37b25a6babe1c542ee6f4423 Mon Sep 17 00:00:00 2001 From: withchao <48119764+withchao@users.noreply.github.com> Date: Wed, 30 Aug 2023 16:37:48 +0800 Subject: [PATCH] fix: Transfer Group Questions (#977) * fix: create group type limit * fix: group notification * fix: group notification * fix: group notification * chore: group member hash * chore: group member hash * chore: group member hash * chore: group member hash * test: log * test: log * test: log * test: log * test: log * sync: hash code * sync: hash code * sync: hash code * test: log * test: log * test: log * test: log * test: log * fix: time stamp * fix: minio sign endpoint opts * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: minio bucket url * fix: op user info * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: importFriends Conversation * fix: importFriends Notification * cicd: robot automated Change Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: importFriends Notification * NotificationUserInfoUpdate * NotificationUserInfoUpdate * NotificationUserInfoUpdate * NotificationUserInfoUpdate * NotificationUserInfoUpdate * NotificationUserInfoUpdate * NotificationUserInfoUpdate * TransferGroupOwner del group hash --------- Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: withchao --- pkg/common/db/controller/group.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/pkg/common/db/controller/group.go b/pkg/common/db/controller/group.go index ca4ac05df..7ece8a07e 100644 --- a/pkg/common/db/controller/group.go +++ b/pkg/common/db/controller/group.go @@ -412,13 +412,8 @@ func (g *groupDatabase) MapGroupMemberNum(ctx context.Context, groupIDs []string return m, nil } -func (g *groupDatabase) TransferGroupOwner( - ctx context.Context, - groupID string, - oldOwnerUserID, newOwnerUserID string, - roleLevel int32, -) error { - if err := g.tx.Transaction(func(tx any) error { +func (g *groupDatabase) TransferGroupOwner(ctx context.Context, groupID string, oldOwnerUserID, newOwnerUserID string, roleLevel int32) error { + return g.tx.Transaction(func(tx any) error { rowsAffected, err := g.groupMemberDB.NewTx(tx).UpdateRoleLevel(ctx, groupID, oldOwnerUserID, roleLevel) if err != nil { return err @@ -433,11 +428,8 @@ func (g *groupDatabase) TransferGroupOwner( if rowsAffected != 1 { return utils.Wrap(fmt.Errorf("newOwnerUserID %s rowsAffected = %d", newOwnerUserID, rowsAffected), "") } - return nil - }); err != nil { - return err - } - return g.cache.DelGroupMembersInfo(groupID, oldOwnerUserID, newOwnerUserID).ExecDel(ctx) + return g.cache.DelGroupMembersInfo(groupID, oldOwnerUserID, newOwnerUserID).DelGroupMembersHash(groupID).ExecDel(ctx) + }) } func (g *groupDatabase) UpdateGroupMember(