diff --git a/CHANGELOG/.chglog/CHANGELOG.tpl.md b/CHANGELOG/.chglog/CHANGELOG.tpl.md
deleted file mode 100644
index 100a29ed8..000000000
--- a/CHANGELOG/.chglog/CHANGELOG.tpl.md
+++ /dev/null
@@ -1,62 +0,0 @@
-# Version logging for OpenIM
-
-
-
-
-
-{{ if .Versions -}}
-
-## [Unreleased]
-
-{{ if .Unreleased.CommitGroups -}}
-{{ range .Unreleased.CommitGroups -}}
-### {{ .Title }}
-{{ range .Commits -}}
-- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
-{{ end }}
-{{ end -}}
-{{ end -}}
-{{ end -}}
-
-{{ range .Versions }}
-
-## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
-{{ range .CommitGroups -}}
-### {{ .Title }}
-{{ range .Commits -}}
-- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
-{{ end }}
-{{ end -}}
-
-{{- if .RevertCommits -}}
-### Reverts
-{{ range .RevertCommits -}}
-- {{ .Revert.Header }}
-{{ end }}
-{{ end -}}
-
-{{- if .MergeCommits -}}
-### Pull Requests
-{{ range .MergeCommits -}}
-- {{ .Header }}
-{{ end }}
-{{ end -}}
-
-{{- if .NoteGroups -}}
-{{ range .NoteGroups -}}
-### {{ .Title }}
-{{ range .Notes }}
-{{ .Body }}
-{{ end }}
-{{ end -}}
-{{ end -}}
-{{ end -}}
-
-{{- if .Versions }}
-[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
-{{ range .Versions -}}
-{{ if .Tag.Previous -}}
-[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
-{{ end -}}
-{{ end -}}
-{{ end -}}
\ No newline at end of file
diff --git a/CHANGELOG/.chglog/config.yml b/CHANGELOG/.chglog/config.yml
deleted file mode 100644
index 2a45bc26a..000000000
--- a/CHANGELOG/.chglog/config.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-bin: git
-style: github
-template: CHANGELOG.tpl.md
-info:
- title: CHANGELOG
- repository_url: https://github.com/openimsdk/open-im-server
-options:
- tag_filter_pattern: '^v'
- sort: "date"
-
- commits:
- filters:
- Type:
- - feat
- - fix
- - perf
- - refactor
- - docs
- - test
- - chore
- - ci
- - build
- sort_by: Scope
-
- commit_groups:
- group_by: Type
- sort_by: Title
- title_order:
- - feat
- - fix
- - perf
- - refactor
- - docs
- - test
- - chore
- - ci
- - build
- title_maps:
- feat: Features
-
- header:
- pattern: ""
- pattern_maps:
- - PropName
-
- issues:
- prefix:
- - #
-
- refs:
- actions:
- - Closes
- - Fixes
-
- merges:
- pattern: "^Merge branch '(\\w+)'$"
- pattern_maps:
- - Source
-
- reverts:
- pattern: "^Revert \"([\\s\\S]*)\"$"
- pattern_maps:
- - Header
-
- notes:
- keywords:
- - BREAKING CHANGE
\ No newline at end of file
diff --git a/build/goreleaser.yaml b/build/goreleaser.yaml
index 93fe9f4c8..c24fb65da 100644
--- a/build/goreleaser.yaml
+++ b/build/goreleaser.yaml
@@ -53,15 +53,8 @@ builds:
- windows
- linux
goarch:
- - s390x
- - mips64
- - mips64le
- amd64
- - ppc64le
- arm64
- goarm:
- - "6"
- - "7"
- binary: openim-cmdutils
id: openim-cmdutils
@@ -71,15 +64,8 @@ builds:
- windows
- linux
goarch:
- - s390x
- - mips64
- - mips64le
- amd64
- - ppc64le
- arm64
- goarm:
- - "6"
- - "7"
- binary: openim-crontask
id: openim-crontask
@@ -89,15 +75,8 @@ builds:
- windows
- linux
goarch:
- - s390x
- - mips64
- - mips64le
- amd64
- - ppc64le
- arm64
- goarm:
- - "6"
- - "7"
- binary: openim-msggateway
id: openim-msggateway
@@ -107,15 +86,8 @@ builds:
- windows
- linux
goarch:
- - s390x
- - mips64
- - mips64le
- amd64
- - ppc64le
- arm64
- goarm:
- - "6"
- - "7"
- binary: openim-msgtransfer
id: openim-msgtransfer
@@ -125,15 +97,8 @@ builds:
- windows
- linux
goarch:
- - s390x
- - mips64
- - mips64le
- amd64
- - ppc64le
- arm64
- goarm:
- - "6"
- - "7"
- binary: openim-push
id: openim-push
@@ -143,15 +108,8 @@ builds:
- windows
- linux
goarch:
- - s390x
- - mips64
- - mips64le
- amd64
- - ppc64le
- arm64
- goarm:
- - "6"
- - "7"
- binary: openim-rpc-auth
id: openim-rpc-auth
@@ -161,15 +119,8 @@ builds:
- windows
- linux
goarch:
- - s390x
- - mips64
- - mips64le
- amd64
- - ppc64le
- arm64
- goarm:
- - "6"
- - "7"
- binary: openim-rpc-conversation
id: openim-rpc-conversation
@@ -179,15 +130,8 @@ builds:
- windows
- linux
goarch:
- - s390x
- - mips64
- - mips64le
- amd64
- - ppc64le
- arm64
- goarm:
- - "6"
- - "7"
- binary: openim-rpc-friend
id: openim-rpc-friend
@@ -197,15 +141,8 @@ builds:
- windows
- linux
goarch:
- - s390x
- - mips64
- - mips64le
- amd64
- - ppc64le
- arm64
- goarm:
- - "6"
- - "7"
- binary: openim-rpc-group
id: openim-rpc-group
@@ -215,15 +152,8 @@ builds:
- windows
- linux
goarch:
- - s390x
- - mips64
- - mips64le
- amd64
- - ppc64le
- arm64
- goarm:
- - "6"
- - "7"
- binary: openim-rpc-msg
id: openim-rpc-msg
@@ -233,15 +163,8 @@ builds:
- windows
- linux
goarch:
- - s390x
- - mips64
- - mips64le
- amd64
- - ppc64le
- arm64
- goarm:
- - "6"
- - "7"
- binary: openim-rpc-third
id: openim-rpc-third
@@ -251,15 +174,8 @@ builds:
- windows
- linux
goarch:
- - s390x
- - mips64
- - mips64le
- amd64
- - ppc64le
- arm64
- goarm:
- - "6"
- - "7"
- binary: openim-rpc-user
id: openim-rpc-user
@@ -269,15 +185,8 @@ builds:
- windows
- linux
goarch:
- - s390x
- - mips64
- - mips64le
- amd64
- - ppc64le
- arm64
- goarm:
- - "6"
- - "7"
# TODOļ¼Need a script, such as the init - release to help binary to find the right directory
diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go
index b8e6c2aca..ef917d539 100644
--- a/internal/rpc/group/group.go
+++ b/internal/rpc/group/group.go
@@ -1180,36 +1180,53 @@ func (g *groupServer) TransferGroupOwner(ctx context.Context, req *pbgroup.Trans
if err != nil {
return nil, err
}
+
if group.Status == constant.GroupStatusDismissed {
return nil, servererrs.ErrDismissedAlready.Wrap()
}
+
if req.OldOwnerUserID == req.NewOwnerUserID {
return nil, errs.ErrArgs.WrapMsg("OldOwnerUserID == NewOwnerUserID")
}
+
members, err := g.db.FindGroupMembers(ctx, req.GroupID, []string{req.OldOwnerUserID, req.NewOwnerUserID})
if err != nil {
return nil, err
}
+
if err := g.PopulateGroupMember(ctx, members...); err != nil {
return nil, err
}
+
memberMap := datautil.SliceToMap(members, func(e *model.GroupMember) string { return e.UserID })
if ids := datautil.Single([]string{req.OldOwnerUserID, req.NewOwnerUserID}, datautil.Keys(memberMap)); len(ids) > 0 {
return nil, errs.ErrArgs.WrapMsg("user not in group " + strings.Join(ids, ","))
}
+
oldOwner := memberMap[req.OldOwnerUserID]
if oldOwner == nil {
return nil, errs.ErrArgs.WrapMsg("OldOwnerUserID not in group " + req.NewOwnerUserID)
}
+
newOwner := memberMap[req.NewOwnerUserID]
if newOwner == nil {
return nil, errs.ErrArgs.WrapMsg("NewOwnerUser not in group " + req.NewOwnerUserID)
}
+
if !authverify.IsAppManagerUid(ctx, g.config.Share.IMAdminUserID) {
if !(mcontext.GetOpUserID(ctx) == oldOwner.UserID && oldOwner.RoleLevel == constant.GroupOwner) {
return nil, errs.ErrNoPermission.WrapMsg("no permission transfer group owner")
}
}
+
+ if newOwner.MuteEndTime != time.Unix(0, 0) {
+ if _, err := g.CancelMuteGroupMember(ctx, &pbgroup.CancelMuteGroupMemberReq{
+ GroupID: group.GroupID,
+ UserID: req.NewOwnerUserID}); err != nil {
+ return nil, err
+ }
+ }
+
if err := g.db.TransferGroupOwner(ctx, req.GroupID, req.OldOwnerUserID, req.NewOwnerUserID, newOwner.RoleLevel); err != nil {
return nil, err
}
@@ -1217,6 +1234,7 @@ func (g *groupServer) TransferGroupOwner(ctx context.Context, req *pbgroup.Trans
g.webhookAfterTransferGroupOwner(ctx, &g.config.WebhooksConfig.AfterTransferGroupOwner, req)
g.notification.GroupOwnerTransferredNotification(ctx, req)
+
return &pbgroup.TransferGroupOwnerResp{}, nil
}
@@ -1425,32 +1443,38 @@ func (g *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbgroup.Ca
if err != nil {
return nil, err
}
+
if err := g.PopulateGroupMember(ctx, member); err != nil {
return nil, err
}
+
if !authverify.IsAppManagerUid(ctx, g.config.Share.IMAdminUserID) {
opMember, err := g.db.TakeGroupMember(ctx, req.GroupID, mcontext.GetOpUserID(ctx))
if err != nil {
return nil, err
}
+
switch member.RoleLevel {
case constant.GroupOwner:
- return nil, errs.ErrNoPermission.WrapMsg("set group owner mute")
+ return nil, errs.ErrNoPermission.WrapMsg("Can not set group owner unmute")
case constant.GroupAdmin:
if opMember.RoleLevel != constant.GroupOwner {
- return nil, errs.ErrNoPermission.WrapMsg("set group admin mute")
+ return nil, errs.ErrNoPermission.WrapMsg("Can not set group admin unmute")
}
case constant.GroupOrdinaryUsers:
if !(opMember.RoleLevel == constant.GroupAdmin || opMember.RoleLevel == constant.GroupOwner) {
- return nil, errs.ErrNoPermission.WrapMsg("set group ordinary users mute")
+ return nil, errs.ErrNoPermission.WrapMsg("Can not set group ordinary users unmute")
}
}
}
+
data := UpdateGroupMemberMutedTimeMap(time.Unix(0, 0))
if err := g.db.UpdateGroupMember(ctx, member.GroupID, member.UserID, data); err != nil {
return nil, err
}
+
g.notification.GroupMemberCancelMutedNotification(ctx, req.GroupID, req.UserID)
+
return &pbgroup.CancelMuteGroupMemberResp{}, nil
}
@@ -1621,7 +1645,7 @@ func (g *groupServer) SetGroupMemberInfo(ctx context.Context, req *pbgroup.SetGr
g.notification.GroupMemberSetToOrdinaryUserNotification(ctx, member.GroupID, member.UserID)
}
}
- if member.Nickname != nil || member.FaceURL != nil || member.Ex != nil || member.RoleLevel != nil {
+ if member.Nickname != nil || member.FaceURL != nil || member.Ex != nil {
g.notification.GroupMemberInfoSetNotification(ctx, member.GroupID, member.UserID)
}
}
diff --git a/internal/rpc/msg/send.go b/internal/rpc/msg/send.go
index a16ca5665..2c3f8c0a3 100644
--- a/internal/rpc/msg/send.go
+++ b/internal/rpc/msg/send.go
@@ -29,7 +29,6 @@ import (
"github.com/openimsdk/tools/log"
"github.com/openimsdk/tools/mcontext"
"github.com/openimsdk/tools/utils/datautil"
- "github.com/openimsdk/tools/utils/stringutil"
)
func (m *msgServer) SendMsg(ctx context.Context, req *pbmsg.SendMsgReq) (*pbmsg.SendMsgResp, error) {
@@ -80,13 +79,17 @@ func (m *msgServer) sendMsgGroupChat(ctx context.Context, req *pbmsg.SendMsgReq)
func (m *msgServer) setConversationAtInfo(nctx context.Context, msg *sdkws.MsgData) {
log.ZDebug(nctx, "setConversationAtInfo", "msg", msg)
+
ctx := mcontext.NewCtx("@@@" + mcontext.GetOperationID(nctx))
+
var atUserID []string
+
conversation := &pbconversation.ConversationReq{
ConversationID: msgprocessor.GetConversationIDByMsg(msg),
ConversationType: msg.SessionType,
GroupID: msg.GroupID,
}
+
tagAll := datautil.Contain(constant.AtAllString, msg.AtUserIDList...)
if tagAll {
memberUserIDList, err := m.GroupLocalCache.GetGroupMemberIDs(ctx, msg.GroupID)
@@ -94,25 +97,35 @@ func (m *msgServer) setConversationAtInfo(nctx context.Context, msg *sdkws.MsgDa
log.ZWarn(ctx, "GetGroupMemberIDs", err)
return
}
- atUserID = stringutil.DifferenceString([]string{constant.AtAllString}, msg.AtUserIDList)
+
+ memberUserIDList = datautil.DeleteElems(memberUserIDList, msg.SendID)
+
+ atUserID = datautil.Single([]string{constant.AtAllString}, msg.AtUserIDList)
+
if len(atUserID) == 0 { // just @everyone
conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.AtAll}
} else { // @Everyone and @other people
conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.AtAllAtMe}
+
err = m.Conversation.SetConversations(ctx, atUserID, conversation)
if err != nil {
log.ZWarn(ctx, "SetConversations", err, "userID", atUserID, "conversation", conversation)
}
- memberUserIDList = stringutil.DifferenceString(atUserID, memberUserIDList)
+
+ memberUserIDList = datautil.Single(atUserID, memberUserIDList)
}
+
conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.AtAll}
+
err = m.Conversation.SetConversations(ctx, memberUserIDList, conversation)
if err != nil {
log.ZWarn(ctx, "SetConversations", err, "userID", memberUserIDList, "conversation", conversation)
}
+
return
}
conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.AtMe}
+
err := m.Conversation.SetConversations(ctx, msg.AtUserIDList, conversation)
if err != nil {
log.ZWarn(ctx, "SetConversations", err, msg.AtUserIDList, conversation)
diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go
index 4669ed513..b47c516d9 100644
--- a/internal/rpc/user/user.go
+++ b/internal/rpc/user/user.go
@@ -116,18 +116,17 @@ func Start(ctx context.Context, config *Config, client registry.SvcDiscoveryRegi
func (s *userServer) GetDesignateUsers(ctx context.Context, req *pbuser.GetDesignateUsersReq) (resp *pbuser.GetDesignateUsersResp, err error) {
resp = &pbuser.GetDesignateUsersResp{}
- users, err := s.db.FindWithError(ctx, req.UserIDs)
+ users, err := s.db.Find(ctx, req.UserIDs)
if err != nil {
return nil, err
}
+
resp.UsersInfo = convert.UsersDB2Pb(users)
return resp, nil
}
// deprecated:
-
-//UpdateUserInfo
-
+// UpdateUserInfo
func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserInfoReq) (resp *pbuser.UpdateUserInfoResp, err error) {
resp = &pbuser.UpdateUserInfoResp{}
err = authverify.CheckAccessV3(ctx, req.UserInfo.UserID, s.config.Share.IMAdminUserID)
diff --git a/pkg/rpccache/user.go b/pkg/rpccache/user.go
index 7c676f30a..79a768597 100644
--- a/pkg/rpccache/user.go
+++ b/pkg/rpccache/user.go
@@ -16,6 +16,7 @@ package rpccache
import (
"context"
+
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/cache/cachekey"
"github.com/openimsdk/open-im-server/v3/pkg/localcache"
@@ -97,6 +98,7 @@ func (u *UserLocalCache) GetUsersInfo(ctx context.Context, userIDs []string) ([]
user, err := u.GetUserInfo(ctx, userID)
if err != nil {
if errs.ErrRecordNotFound.Is(err) {
+ log.ZWarn(ctx, "User info notFound", err, "userID", userID)
continue
}
return nil, err