fix update user.FaceURL do not trigger GroupMemberInfoSetNotification (#1267)
* fix update user.FaceURL do not trigger GroupMemberInfoSetNotification * cicd: robot automated Change --------- Co-authored-by: a3d21 <a3d21@users.noreply.github.com>
This commit is contained in:
parent
e4f3e34249
commit
8a13017665
|
@ -26,6 +26,7 @@ import (
|
|||
"github.com/OpenIMSDK/protocol/constant"
|
||||
"github.com/OpenIMSDK/tools/discoveryregistry"
|
||||
"github.com/OpenIMSDK/tools/log"
|
||||
|
||||
"github.com/openimsdk/open-im-server/v3/internal/api"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
|
|
|
@ -154,16 +154,16 @@ func (s *groupServer) CheckGroupAdmin(ctx context.Context, groupID string) error
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *groupServer) GetUsernameMap(ctx context.Context, userIDs []string, complete bool) (map[string]string, error) {
|
||||
func (s *groupServer) GetPublicUserInfoMap(ctx context.Context, userIDs []string, complete bool) (map[string]*sdkws.PublicUserInfo, error) {
|
||||
if len(userIDs) == 0 {
|
||||
return map[string]string{}, nil
|
||||
return map[string]*sdkws.PublicUserInfo{}, nil
|
||||
}
|
||||
users, err := s.User.GetPublicUserInfos(ctx, userIDs, complete)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return utils.SliceToMapAny(users, func(e *sdkws.PublicUserInfo) (string, string) {
|
||||
return e.UserID, e.Nickname
|
||||
return utils.SliceToMapAny(users, func(e *sdkws.PublicUserInfo) (string, *sdkws.PublicUserInfo) {
|
||||
return e.UserID, e
|
||||
}), nil
|
||||
}
|
||||
|
||||
|
@ -468,15 +468,18 @@ func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbgroup.GetGro
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
nameMap, err := s.GetUsernameMap(ctx, utils.Filter(members, func(e *relationtb.GroupMemberModel) (string, bool) {
|
||||
return e.UserID, e.Nickname == ""
|
||||
publicUserInfoMap, err := s.GetPublicUserInfoMap(ctx, utils.Filter(members, func(e *relationtb.GroupMemberModel) (string, bool) {
|
||||
return e.UserID, e.Nickname == "" || e.FaceURL == ""
|
||||
}), true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.Members = utils.Slice(members, func(e *relationtb.GroupMemberModel) *sdkws.GroupMemberFullInfo {
|
||||
if e.Nickname == "" {
|
||||
e.Nickname = nameMap[e.UserID]
|
||||
e.Nickname = publicUserInfoMap[e.UserID].Nickname
|
||||
}
|
||||
if e.FaceURL == "" {
|
||||
e.FaceURL = publicUserInfoMap[e.UserID].FaceURL
|
||||
}
|
||||
return convert.Db2PbGroupMember(e)
|
||||
})
|
||||
|
@ -616,15 +619,18 @@ func (s *groupServer) GetGroupMembersInfo(ctx context.Context, req *pbgroup.GetG
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
nameMap, err := s.GetUsernameMap(ctx, utils.Filter(members, func(e *relationtb.GroupMemberModel) (string, bool) {
|
||||
return e.UserID, e.Nickname == ""
|
||||
publicUserInfoMap, err := s.GetPublicUserInfoMap(ctx, utils.Filter(members, func(e *relationtb.GroupMemberModel) (string, bool) {
|
||||
return e.UserID, e.Nickname == "" || e.FaceURL == ""
|
||||
}), true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.Members = utils.Slice(members, func(e *relationtb.GroupMemberModel) *sdkws.GroupMemberFullInfo {
|
||||
if e.Nickname == "" {
|
||||
e.Nickname = nameMap[e.UserID]
|
||||
e.Nickname = publicUserInfoMap[e.UserID].Nickname
|
||||
}
|
||||
if e.FaceURL == "" {
|
||||
e.FaceURL = publicUserInfoMap[e.UserID].FaceURL
|
||||
}
|
||||
return convert.Db2PbGroupMember(e)
|
||||
})
|
||||
|
@ -1067,15 +1073,18 @@ func (s *groupServer) GetGroupMembersCMS(ctx context.Context, req *pbgroup.GetGr
|
|||
return nil, err
|
||||
}
|
||||
resp.Total = total
|
||||
nameMap, err := s.GetUsernameMap(ctx, utils.Filter(members, func(e *relationtb.GroupMemberModel) (string, bool) {
|
||||
return e.UserID, e.Nickname == ""
|
||||
nameMap, err := s.GetPublicUserInfoMap(ctx, utils.Filter(members, func(e *relationtb.GroupMemberModel) (string, bool) {
|
||||
return e.UserID, e.Nickname == "" || e.FaceURL == ""
|
||||
}), true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.Members = utils.Slice(members, func(e *relationtb.GroupMemberModel) *sdkws.GroupMemberFullInfo {
|
||||
if e.Nickname == "" {
|
||||
e.Nickname = nameMap[e.UserID]
|
||||
e.Nickname = nameMap[e.UserID].Nickname
|
||||
}
|
||||
if e.FaceURL == "" {
|
||||
e.FaceURL = nameMap[e.UserID].FaceURL
|
||||
}
|
||||
return convert.Db2PbGroupMember(e)
|
||||
})
|
||||
|
@ -1461,7 +1470,7 @@ func (s *groupServer) GetUserInGroupMembers(ctx context.Context, req *pbgroup.Ge
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
nameMap, err := s.GetUsernameMap(ctx, utils.Filter(members, func(e *relationtb.GroupMemberModel) (string, bool) {
|
||||
publicUserInfoMap, err := s.GetPublicUserInfoMap(ctx, utils.Filter(members, func(e *relationtb.GroupMemberModel) (string, bool) {
|
||||
return e.UserID, e.Nickname == ""
|
||||
}), true)
|
||||
if err != nil {
|
||||
|
@ -1469,7 +1478,10 @@ func (s *groupServer) GetUserInGroupMembers(ctx context.Context, req *pbgroup.Ge
|
|||
}
|
||||
resp.Members = utils.Slice(members, func(e *relationtb.GroupMemberModel) *sdkws.GroupMemberFullInfo {
|
||||
if e.Nickname == "" {
|
||||
e.Nickname = nameMap[e.UserID]
|
||||
e.Nickname = publicUserInfoMap[e.UserID].Nickname
|
||||
}
|
||||
if e.FaceURL == "" {
|
||||
e.FaceURL = publicUserInfoMap[e.UserID].FaceURL
|
||||
}
|
||||
return convert.Db2PbGroupMember(e)
|
||||
})
|
||||
|
@ -1494,15 +1506,18 @@ func (s *groupServer) GetGroupMemberRoleLevel(ctx context.Context, req *pbgroup.
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
nameMap, err := s.GetUsernameMap(ctx, utils.Filter(members, func(e *relationtb.GroupMemberModel) (string, bool) {
|
||||
return e.UserID, e.Nickname == ""
|
||||
publicUserInfoMap, err := s.GetPublicUserInfoMap(ctx, utils.Filter(members, func(e *relationtb.GroupMemberModel) (string, bool) {
|
||||
return e.UserID, e.Nickname == "" || e.FaceURL == ""
|
||||
}), true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.Members = utils.Slice(members, func(e *relationtb.GroupMemberModel) *sdkws.GroupMemberFullInfo {
|
||||
if e.Nickname == "" {
|
||||
e.Nickname = nameMap[e.UserID]
|
||||
e.Nickname = publicUserInfoMap[e.UserID].Nickname
|
||||
}
|
||||
if e.FaceURL == "" {
|
||||
e.FaceURL = publicUserInfoMap[e.UserID].FaceURL
|
||||
}
|
||||
return convert.Db2PbGroupMember(e)
|
||||
})
|
||||
|
|
|
@ -701,7 +701,14 @@ func (db *commonMsgDatabase) DeleteConversationMsgsAndSetMinSeq(ctx context.Cont
|
|||
return db.cache.SetMinSeq(ctx, conversationID, minSeq)
|
||||
}
|
||||
|
||||
func processMsgDocModel(ctx context.Context, msgDocModel *unrelationtb.MsgDocModel, userID, conversationID string, index int64, destructTime int64, lastMsgDestructTime time.Time) (seqs []int64, over bool) {
|
||||
func processMsgDocModel(
|
||||
ctx context.Context,
|
||||
msgDocModel *unrelationtb.MsgDocModel,
|
||||
userID, conversationID string,
|
||||
index int64,
|
||||
destructTime int64,
|
||||
lastMsgDestructTime time.Time,
|
||||
) (seqs []int64, over bool) {
|
||||
if len(msgDocModel.Msg) > 0 {
|
||||
i := 0
|
||||
for _, msg := range msgDocModel.Msg {
|
||||
|
@ -823,7 +830,14 @@ func handleFullAndExpiredForDeleteMsgRecursion(ctx context.Context, msgDocModel
|
|||
delStruct.minSeq = msgDocModel.Msg[len(msgDocModel.Msg)-1].Msg.Seq
|
||||
}
|
||||
|
||||
func handleNotFullAndExpiredForDeleteMsgRecursion(ctx context.Context, msgDocModel *unrelationtb.MsgDocModel, remainTime, index int64, conversationID string, delStruct *delMsgRecursionStruct, db *commonMsgDatabase) {
|
||||
func handleNotFullAndExpiredForDeleteMsgRecursion(
|
||||
ctx context.Context,
|
||||
msgDocModel *unrelationtb.MsgDocModel,
|
||||
remainTime, index int64,
|
||||
conversationID string,
|
||||
delStruct *delMsgRecursionStruct,
|
||||
db *commonMsgDatabase,
|
||||
) {
|
||||
var delMsgIndexs []int
|
||||
for i, MsgInfoModel := range msgDocModel.Msg {
|
||||
if MsgInfoModel != nil && MsgInfoModel.Msg != nil {
|
||||
|
|
|
@ -430,7 +430,13 @@ func (m *Minio) presignedGetObject(ctx context.Context, name string, expire time
|
|||
return rawURL.String(), nil
|
||||
}
|
||||
|
||||
func (m *Minio) getImageInfoForAccessURL(ctx context.Context, name string, expire time.Duration, opt *s3.AccessURLOption, reqParams url.Values) (fileInfo *s3.ObjectInfo, objectInfoPath, msg string, err error) {
|
||||
func (m *Minio) getImageInfoForAccessURL(
|
||||
ctx context.Context,
|
||||
name string,
|
||||
expire time.Duration,
|
||||
opt *s3.AccessURLOption,
|
||||
reqParams url.Values,
|
||||
) (fileInfo *s3.ObjectInfo, objectInfoPath, msg string, err error) {
|
||||
if opt != nil {
|
||||
if opt.ContentType != "" {
|
||||
reqParams.Set("response-content-type", opt.ContentType)
|
||||
|
|
|
@ -30,7 +30,7 @@ type GroupModel struct {
|
|||
Introduction string `gorm:"column:introduction;size:255" json:"introduction"`
|
||||
FaceURL string `gorm:"column:face_url;size:255" json:"faceURL"`
|
||||
CreateTime time.Time `gorm:"column:create_time;index:create_time;autoCreateTime"`
|
||||
Ex string `gorm:"column:ex;size:1024" json:"ex"`
|
||||
Ex string `gorm:"column:ex;size:1024" json:"ex"`
|
||||
Status int32 `gorm:"column:status"`
|
||||
CreatorUserID string `gorm:"column:creator_user_id;size:64"`
|
||||
GroupType int32 `gorm:"column:group_type"`
|
||||
|
|
Loading…
Reference in New Issue