mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-10-29 07:12:14 +08:00 
			
		
		
		
	feat: GroupApplicationAgreeMemberEnterNotification
This commit is contained in:
		
							parent
							
								
									790f39f480
								
							
						
					
					
						commit
						f65cfba832
					
				
							
								
								
									
										6
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								go.mod
									
									
									
									
									
								
							| @ -12,7 +12,7 @@ require ( | |||||||
| 	github.com/gorilla/websocket v1.5.1 | 	github.com/gorilla/websocket v1.5.1 | ||||||
| 	github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 | 	github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 | ||||||
| 	github.com/mitchellh/mapstructure v1.5.0 | 	github.com/mitchellh/mapstructure v1.5.0 | ||||||
| 	github.com/openimsdk/protocol v0.0.72-alpha.10 | 	github.com/openimsdk/protocol v0.0.72-alpha.11 | ||||||
| 	github.com/openimsdk/tools v0.0.49-alpha.55 | 	github.com/openimsdk/tools v0.0.49-alpha.55 | ||||||
| 	github.com/pkg/errors v0.9.1 // indirect | 	github.com/pkg/errors v0.9.1 // indirect | ||||||
| 	github.com/prometheus/client_golang v1.18.0 | 	github.com/prometheus/client_golang v1.18.0 | ||||||
| @ -195,6 +195,4 @@ require ( | |||||||
| 	gopkg.in/ini.v1 v1.67.0 // indirect | 	gopkg.in/ini.v1 v1.67.0 // indirect | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| //replace ( | //replace github.com/openimsdk/protocol => /Users/chao/Desktop/withchao/protocol | ||||||
| //	github.com/openimsdk/protocol => /Users/chao/Desktop/withchao/protocol |  | ||||||
| //) |  | ||||||
|  | |||||||
							
								
								
									
										4
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.sum
									
									
									
									
									
								
							| @ -319,8 +319,8 @@ github.com/onsi/gomega v1.25.0 h1:Vw7br2PCDYijJHSfBOWhov+8cAnUf8MfMaIOV323l6Y= | |||||||
| github.com/onsi/gomega v1.25.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= | github.com/onsi/gomega v1.25.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= | ||||||
| github.com/openimsdk/gomake v0.0.14-alpha.5 h1:VY9c5x515lTfmdhhPjMvR3BBRrRquAUCFsz7t7vbv7Y= | github.com/openimsdk/gomake v0.0.14-alpha.5 h1:VY9c5x515lTfmdhhPjMvR3BBRrRquAUCFsz7t7vbv7Y= | ||||||
| github.com/openimsdk/gomake v0.0.14-alpha.5/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI= | github.com/openimsdk/gomake v0.0.14-alpha.5/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI= | ||||||
| github.com/openimsdk/protocol v0.0.72-alpha.10 h1:5nroDqaPFj44q6fZk98PRtwEt9VDi3Kg6nVIRCPZ/oE= | github.com/openimsdk/protocol v0.0.72-alpha.11 h1:SlSG80C3Y0iOXlsbnh7ZqE9imMoBRy9i+9ebwsbSqfM= | ||||||
| github.com/openimsdk/protocol v0.0.72-alpha.10/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8= | github.com/openimsdk/protocol v0.0.72-alpha.11/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8= | ||||||
| github.com/openimsdk/tools v0.0.49-alpha.55 h1:KPgC53oqiwZYssLKljhtXbWXifMlTj2SSQEusj4Uf4k= | github.com/openimsdk/tools v0.0.49-alpha.55 h1:KPgC53oqiwZYssLKljhtXbWXifMlTj2SSQEusj4Uf4k= | ||||||
| github.com/openimsdk/tools v0.0.49-alpha.55/go.mod h1:h1cYmfyaVtgFbKmb1Cfsl8XwUOMTt8ubVUQrdGtsUh4= | github.com/openimsdk/tools v0.0.49-alpha.55/go.mod h1:h1cYmfyaVtgFbKmb1Cfsl8XwUOMTt8ubVUQrdGtsUh4= | ||||||
| github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= | github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= | ||||||
|  | |||||||
| @ -833,7 +833,7 @@ func (g *groupServer) GroupApplicationResponse(ctx context.Context, req *pbgroup | |||||||
| 		if member == nil { | 		if member == nil { | ||||||
| 			log.ZDebug(ctx, "GroupApplicationResponse", "member is nil") | 			log.ZDebug(ctx, "GroupApplicationResponse", "member is nil") | ||||||
| 		} else { | 		} else { | ||||||
| 			if err = g.notification.MemberEnterNotification(ctx, req.GroupID, req.FromUserID); err != nil { | 			if err = g.notification.GroupApplicationAgreeMemberEnterNotification(ctx, req.GroupID, groupRequest.InviterUserID, req.FromUserID); err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | |||||||
| @ -227,10 +227,13 @@ func (g *GroupNotificationSender) groupMemberDB2PB(member *model.GroupMember, ap | |||||||
| } */ | } */ | ||||||
| 
 | 
 | ||||||
| func (g *GroupNotificationSender) fillOpUser(ctx context.Context, opUser **sdkws.GroupMemberFullInfo, groupID string) (err error) { | func (g *GroupNotificationSender) fillOpUser(ctx context.Context, opUser **sdkws.GroupMemberFullInfo, groupID string) (err error) { | ||||||
|  | 	return g.fillOpUserByUserID(ctx, mcontext.GetOpUserID(ctx), opUser, groupID) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func (g *GroupNotificationSender) fillOpUserByUserID(ctx context.Context, userID string, opUser **sdkws.GroupMemberFullInfo, groupID string) error { | ||||||
| 	if opUser == nil { | 	if opUser == nil { | ||||||
| 		return errs.ErrInternalServer.WrapMsg("**sdkws.GroupMemberFullInfo is nil") | 		return errs.ErrInternalServer.WrapMsg("**sdkws.GroupMemberFullInfo is nil") | ||||||
| 	} | 	} | ||||||
| 	userID := mcontext.GetOpUserID(ctx) |  | ||||||
| 	if groupID != "" { | 	if groupID != "" { | ||||||
| 		if authverify.IsManagerUserID(userID, g.config.Share.IMAdminUserID) { | 		if authverify.IsManagerUserID(userID, g.config.Share.IMAdminUserID) { | ||||||
| 			*opUser = &sdkws.GroupMemberFullInfo{ | 			*opUser = &sdkws.GroupMemberFullInfo{ | ||||||
| @ -509,7 +512,7 @@ func (g *GroupNotificationSender) MemberKickedNotification(ctx context.Context, | |||||||
| 	g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.MemberKickedNotification, tips) | 	g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.MemberKickedNotification, tips) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (g *GroupNotificationSender) MemberEnterNotification(ctx context.Context, groupID string, entrantUserID ...string) error { | func (g *GroupNotificationSender) GroupApplicationAgreeMemberEnterNotification(ctx context.Context, groupID string, invitedOpUserID string, entrantUserID ...string) error { | ||||||
| 	var err error | 	var err error | ||||||
| 	defer func() { | 	defer func() { | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| @ -546,15 +549,32 @@ func (g *GroupNotificationSender) MemberEnterNotification(ctx context.Context, g | |||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	tips := &sdkws.MemberInvitedTips{Group: group, InvitedUserList: users} | 	tips := &sdkws.MemberInvitedTips{ | ||||||
| 	if err = g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil { | 		Group:           group, | ||||||
|  | 		InvitedUserList: users, | ||||||
|  | 	} | ||||||
|  | 	opUserID := mcontext.GetOpUserID(ctx) | ||||||
|  | 	if err = g.fillOpUserByUserID(ctx, opUserID, &tips.OpUser, tips.Group.GroupID); err != nil { | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
|  | 	switch { | ||||||
|  | 	case invitedOpUserID == "": | ||||||
|  | 	case invitedOpUserID == opUserID: | ||||||
|  | 		tips.InviterUser = tips.OpUser | ||||||
|  | 	default: | ||||||
|  | 		if err = g.fillOpUserByUserID(ctx, invitedOpUserID, &tips.InviterUser, tips.Group.GroupID); err != nil { | ||||||
|  | 			return err | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| 	g.setVersion(ctx, &tips.GroupMemberVersion, &tips.GroupMemberVersionID, database.GroupMemberVersionName, tips.Group.GroupID) | 	g.setVersion(ctx, &tips.GroupMemberVersion, &tips.GroupMemberVersionID, database.GroupMemberVersionName, tips.Group.GroupID) | ||||||
| 	g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.MemberInvitedNotification, tips) | 	g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.MemberInvitedNotification, tips) | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func (g *GroupNotificationSender) MemberEnterNotification(ctx context.Context, groupID string, entrantUserID ...string) error { | ||||||
|  | 	return g.GroupApplicationAgreeMemberEnterNotification(ctx, groupID, "", entrantUserID...) | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func (g *GroupNotificationSender) GroupDismissedNotification(ctx context.Context, tips *sdkws.GroupDismissedTips) { | func (g *GroupNotificationSender) GroupDismissedNotification(ctx context.Context, tips *sdkws.GroupDismissedTips) { | ||||||
| 	var err error | 	var err error | ||||||
| 	defer func() { | 	defer func() { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user