|
|
|
@ -220,7 +220,13 @@ func (g *GroupNotificationSender) getUsersInfoMap(ctx context.Context, userIDs [
|
|
|
|
|
return result, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) fillOpUser(ctx context.Context, opUser **sdkws.GroupMemberFullInfo, groupID string) error {
|
|
|
|
|
func (g *GroupNotificationSender) fillOpUser(ctx context.Context, opUser **sdkws.GroupMemberFullInfo, groupID string) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
if opUser == nil {
|
|
|
|
|
return errs.ErrInternalServer.Wrap("**sdkws.GroupMemberFullInfo is nil")
|
|
|
|
|
}
|
|
|
|
@ -260,6 +266,12 @@ func (g *GroupNotificationSender) fillOpUser(ctx context.Context, opUser **sdkws
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) GroupCreatedNotification(ctx context.Context, tips *sdkws.GroupCreatedTips) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
@ -267,6 +279,12 @@ func (g *GroupNotificationSender) GroupCreatedNotification(ctx context.Context,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) GroupInfoSetNotification(ctx context.Context, tips *sdkws.GroupInfoSetTips) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
@ -274,6 +292,12 @@ func (g *GroupNotificationSender) GroupInfoSetNotification(ctx context.Context,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) GroupInfoSetNameNotification(ctx context.Context, tips *sdkws.GroupInfoSetNameTips) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
@ -281,6 +305,12 @@ func (g *GroupNotificationSender) GroupInfoSetNameNotification(ctx context.Conte
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) GroupInfoSetAnnouncementNotification(ctx context.Context, tips *sdkws.GroupInfoSetAnnouncementTips) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
@ -288,6 +318,12 @@ func (g *GroupNotificationSender) GroupInfoSetAnnouncementNotification(ctx conte
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) JoinGroupApplicationNotification(ctx context.Context, req *pbGroup.JoinGroupReq) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
group, err := g.getGroupInfo(ctx, req.GroupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
@ -355,6 +391,12 @@ func (g *GroupNotificationSender) GroupApplicationAcceptedNotification(ctx conte
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) GroupApplicationRejectedNotification(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
group, err := g.getGroupInfo(ctx, req.GroupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
@ -377,6 +419,12 @@ func (g *GroupNotificationSender) GroupApplicationRejectedNotification(ctx conte
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) GroupOwnerTransferredNotification(ctx context.Context, req *pbGroup.TransferGroupOwnerReq) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
group, err := g.getGroupInfo(ctx, req.GroupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
@ -394,6 +442,12 @@ func (g *GroupNotificationSender) GroupOwnerTransferredNotification(ctx context.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) MemberKickedNotification(ctx context.Context, tips *sdkws.MemberKickedTips) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
@ -401,6 +455,12 @@ func (g *GroupNotificationSender) MemberKickedNotification(ctx context.Context,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) MemberInvitedNotification(ctx context.Context, groupID, reason string, invitedUserIDList []string) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
group, err := g.getGroupInfo(ctx, groupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
@ -419,12 +479,18 @@ func (g *GroupNotificationSender) MemberInvitedNotification(ctx context.Context,
|
|
|
|
|
return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.MemberInvitedNotification, tips)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) MemberEnterNotification(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) (err error) {
|
|
|
|
|
group, err := g.getGroupInfo(ctx, req.GroupID)
|
|
|
|
|
func (g *GroupNotificationSender) MemberEnterNotification(ctx context.Context, groupID string, entrantUserID string) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
group, err := g.getGroupInfo(ctx, groupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
user, err := g.getGroupMember(ctx, req.GroupID, req.FromUserID)
|
|
|
|
|
user, err := g.getGroupMember(ctx, groupID, entrantUserID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
@ -433,6 +499,12 @@ func (g *GroupNotificationSender) MemberEnterNotification(ctx context.Context, r
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) GroupDismissedNotification(ctx context.Context, tips *sdkws.GroupDismissedTips) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
@ -440,6 +512,12 @@ func (g *GroupNotificationSender) GroupDismissedNotification(ctx context.Context
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) GroupMemberMutedNotification(ctx context.Context, groupID, groupMemberUserID string, mutedSeconds uint32) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
group, err := g.getGroupInfo(ctx, groupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
@ -459,6 +537,12 @@ func (g *GroupNotificationSender) GroupMemberMutedNotification(ctx context.Conte
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) GroupMemberCancelMutedNotification(ctx context.Context, groupID, groupMemberUserID string) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
group, err := g.getGroupInfo(ctx, groupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
@ -475,6 +559,12 @@ func (g *GroupNotificationSender) GroupMemberCancelMutedNotification(ctx context
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) GroupMutedNotification(ctx context.Context, groupID string) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
group, err := g.getGroupInfo(ctx, groupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
@ -494,6 +584,12 @@ func (g *GroupNotificationSender) GroupMutedNotification(ctx context.Context, gr
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) GroupCancelMutedNotification(ctx context.Context, groupID string) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
group, err := g.getGroupInfo(ctx, groupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
@ -513,6 +609,12 @@ func (g *GroupNotificationSender) GroupCancelMutedNotification(ctx context.Conte
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) GroupMemberInfoSetNotification(ctx context.Context, groupID, groupMemberUserID string) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
group, err := g.getGroupInfo(ctx, groupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
@ -529,22 +631,12 @@ func (g *GroupNotificationSender) GroupMemberInfoSetNotification(ctx context.Con
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) GroupMemberSetToAdminNotification(ctx context.Context, groupID, groupMemberUserID string) (err error) {
|
|
|
|
|
group, err := g.getGroupInfo(ctx, groupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
user, err := g.getGroupMemberMap(ctx, groupID, []string{mcontext.GetOpUserID(ctx), groupMemberUserID})
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
tips := &sdkws.GroupMemberInfoSetTips{Group: group, OpUser: user[mcontext.GetOpUserID(ctx)], ChangedUser: user[groupMemberUserID]}
|
|
|
|
|
if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
log.ZError(ctx, utils.GetFuncName(1)+" failed", err)
|
|
|
|
|
}
|
|
|
|
|
return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupMemberSetToAdminNotification, tips)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) GroupMemberSetToOrdinaryUserNotification(ctx context.Context, groupID, groupMemberUserID string) (err error) {
|
|
|
|
|
}()
|
|
|
|
|
group, err := g.getGroupInfo(ctx, groupID)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
@ -557,10 +649,10 @@ func (g *GroupNotificationSender) GroupMemberSetToOrdinaryUserNotification(ctx c
|
|
|
|
|
if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupMemberSetToOrdinaryUserNotification, tips)
|
|
|
|
|
return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupMemberSetToAdminNotification, tips)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) MemberEnterDirectlyNotification(ctx context.Context, groupID string, entrantUserID string) (err error) {
|
|
|
|
|
func (g *GroupNotificationSender) GroupMemberSetToOrdinaryUserNotification(ctx context.Context, groupID, groupMemberUserID string) (err error) {
|
|
|
|
|
defer log.ZDebug(ctx, "return")
|
|
|
|
|
defer func() {
|
|
|
|
|
if err != nil {
|
|
|
|
@ -571,12 +663,15 @@ func (g *GroupNotificationSender) MemberEnterDirectlyNotification(ctx context.Co
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
user, err := g.getGroupMember(ctx, groupID, entrantUserID)
|
|
|
|
|
user, err := g.getGroupMemberMap(ctx, groupID, []string{mcontext.GetOpUserID(ctx), groupMemberUserID})
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
tips := &sdkws.MemberEnterTips{Group: group, EntrantUser: user}
|
|
|
|
|
return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.MemberEnterNotification, tips)
|
|
|
|
|
tips := &sdkws.GroupMemberInfoSetTips{Group: group, OpUser: user[mcontext.GetOpUserID(ctx)], ChangedUser: user[groupMemberUserID]}
|
|
|
|
|
if err := g.fillOpUser(ctx, &tips.OpUser, tips.Group.GroupID); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupMemberSetToOrdinaryUserNotification, tips)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (g *GroupNotificationSender) SuperGroupNotification(ctx context.Context, sendID, recvID string) (err error) {
|
|
|
|
|