@ -18,6 +18,7 @@ import (
"context"
"context"
"errors"
"errors"
"fmt"
"fmt"
"github.com/openimsdk/open-im-server/v3/pkg/rpcli"
"time"
"time"
"github.com/openimsdk/open-im-server/v3/pkg/authverify"
"github.com/openimsdk/open-im-server/v3/pkg/authverify"
@ -28,13 +29,11 @@ import (
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/versionctx"
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/versionctx"
"github.com/openimsdk/open-im-server/v3/pkg/msgprocessor"
"github.com/openimsdk/open-im-server/v3/pkg/msgprocessor"
"github.com/openimsdk/open-im-server/v3/pkg/ rpcclient "
"github.com/openimsdk/open-im-server/v3/pkg/ notification "
"github.com/openimsdk/open-im-server/v3/pkg/ rpcclient/ notification"
"github.com/openimsdk/open-im-server/v3/pkg/ notification/common_user "
"github.com/openimsdk/protocol/constant"
"github.com/openimsdk/protocol/constant"
pbconv "github.com/openimsdk/protocol/conversation"
pbgroup "github.com/openimsdk/protocol/group"
pbgroup "github.com/openimsdk/protocol/group"
"github.com/openimsdk/protocol/msg"
"github.com/openimsdk/protocol/msg"
"github.com/openimsdk/protocol/rpccall"
"github.com/openimsdk/protocol/sdkws"
"github.com/openimsdk/protocol/sdkws"
"github.com/openimsdk/tools/errs"
"github.com/openimsdk/tools/errs"
"github.com/openimsdk/tools/log"
"github.com/openimsdk/tools/log"
@ -50,27 +49,38 @@ const (
adminReceiver
adminReceiver
)
)
func NewGroupNotificationSender (
func NewNotificationSender ( db controller . GroupDatabase , config * Config , userClient * rpcli . UserClient , msgClient * rpcli . MsgClient , conversationClient * rpcli . ConversationClient ) * NotificationSender {
db controller . GroupDatabase ,
return & NotificationSender {
config * Config ,
NotificationSender : rpcclient . NewNotificationSender ( & config . NotificationConfig ,
fn func ( ctx context . Context , userIDs [ ] string ) ( [ ] notification . CommonUser , error ) ,
rpcclient . WithRpcClient ( func ( ctx context . Context , req * msg . SendMsgReq ) ( * msg . SendMsgResp , error ) {
) * GroupNotificationSender {
return msgClient . SendMsg ( ctx , req )
return & GroupNotificationSender {
} ) ,
NotificationSender : rpcclient . NewNotificationSender ( & config . NotificationConfig , rpcclient . WithRpcClient ( ) , rpcclient . WithUserRpcClient ( ) ) ,
rpcclient . WithUserRpcClient ( userClient . GetUserInfo ) ,
getUsersInfo : fn ,
) ,
getUsersInfo : func ( ctx context . Context , userIDs [ ] string ) ( [ ] common_user . CommonUser , error ) {
users , err := userClient . GetUsersInfo ( ctx , userIDs )
if err != nil {
return nil , err
}
return datautil . Slice ( users , func ( e * sdkws . UserInfo ) common_user . CommonUser { return e } ) , nil
} ,
db : db ,
db : db ,
config : config ,
config : config ,
msgClient : msgClient ,
conversationClient : conversationClient ,
}
}
}
}
type GroupNotificationSender struct {
type NotificationSender struct {
* rpcclient . NotificationSender
* rpcclient . NotificationSender
getUsersInfo func ( ctx context . Context , userIDs [ ] string ) ( [ ] notification . CommonUser , error )
getUsersInfo func ( ctx context . Context , userIDs [ ] string ) ( [ ] common_user . CommonUser , error )
db controller . GroupDatabase
db controller . GroupDatabase
config * Config
config * Config
msgClient * rpcli . MsgClient
conversationClient * rpcli . ConversationClient
}
}
func ( g * Group NotificationSender) PopulateGroupMember ( ctx context . Context , members ... * model . GroupMember ) error {
func ( g * NotificationSender) PopulateGroupMember ( ctx context . Context , members ... * model . GroupMember ) error {
if len ( members ) == 0 {
if len ( members ) == 0 {
return nil
return nil
}
}
@ -85,7 +95,7 @@ func (g *GroupNotificationSender) PopulateGroupMember(ctx context.Context, membe
if err != nil {
if err != nil {
return err
return err
}
}
userMap := make ( map [ string ] notification . CommonUser )
userMap := make ( map [ string ] common_user . CommonUser )
for i , user := range users {
for i , user := range users {
userMap [ user . GetUserID ( ) ] = users [ i ]
userMap [ user . GetUserID ( ) ] = users [ i ]
}
}
@ -105,7 +115,7 @@ func (g *GroupNotificationSender) PopulateGroupMember(ctx context.Context, membe
return nil
return nil
}
}
func ( g * Group NotificationSender) getUser ( ctx context . Context , userID string ) ( * sdkws . PublicUserInfo , error ) {
func ( g * NotificationSender) getUser ( ctx context . Context , userID string ) ( * sdkws . PublicUserInfo , error ) {
users , err := g . getUsersInfo ( ctx , [ ] string { userID } )
users , err := g . getUsersInfo ( ctx , [ ] string { userID } )
if err != nil {
if err != nil {
return nil , err
return nil , err
@ -121,7 +131,7 @@ func (g *GroupNotificationSender) getUser(ctx context.Context, userID string) (*
} , nil
} , nil
}
}
func ( g * Group NotificationSender) getGroupInfo ( ctx context . Context , groupID string ) ( * sdkws . GroupInfo , error ) {
func ( g * NotificationSender) getGroupInfo ( ctx context . Context , groupID string ) ( * sdkws . GroupInfo , error ) {
gm , err := g . db . TakeGroup ( ctx , groupID )
gm , err := g . db . TakeGroup ( ctx , groupID )
if err != nil {
if err != nil {
return nil , err
return nil , err
@ -142,7 +152,7 @@ func (g *GroupNotificationSender) getGroupInfo(ctx context.Context, groupID stri
return convert . Db2PbGroupInfo ( gm , ownerUserID , num ) , nil
return convert . Db2PbGroupInfo ( gm , ownerUserID , num ) , nil
}
}
func ( g * Group NotificationSender) getGroupMembers ( ctx context . Context , groupID string , userIDs [ ] string ) ( [ ] * sdkws . GroupMemberFullInfo , error ) {
func ( g * NotificationSender) getGroupMembers ( ctx context . Context , groupID string , userIDs [ ] string ) ( [ ] * sdkws . GroupMemberFullInfo , error ) {
members , err := g . db . FindGroupMembers ( ctx , groupID , userIDs )
members , err := g . db . FindGroupMembers ( ctx , groupID , userIDs )
if err != nil {
if err != nil {
return nil , err
return nil , err
@ -158,7 +168,7 @@ func (g *GroupNotificationSender) getGroupMembers(ctx context.Context, groupID s
return res , nil
return res , nil
}
}
func ( g * Group NotificationSender) getGroupMemberMap ( ctx context . Context , groupID string , userIDs [ ] string ) ( map [ string ] * sdkws . GroupMemberFullInfo , error ) {
func ( g * NotificationSender) getGroupMemberMap ( ctx context . Context , groupID string , userIDs [ ] string ) ( map [ string ] * sdkws . GroupMemberFullInfo , error ) {
members , err := g . getGroupMembers ( ctx , groupID , userIDs )
members , err := g . getGroupMembers ( ctx , groupID , userIDs )
if err != nil {
if err != nil {
return nil , err
return nil , err
@ -170,7 +180,7 @@ func (g *GroupNotificationSender) getGroupMemberMap(ctx context.Context, groupID
return m , nil
return m , nil
}
}
func ( g * Group NotificationSender) getGroupMember ( ctx context . Context , groupID string , userID string ) ( * sdkws . GroupMemberFullInfo , error ) {
func ( g * NotificationSender) getGroupMember ( ctx context . Context , groupID string , userID string ) ( * sdkws . GroupMemberFullInfo , error ) {
members , err := g . getGroupMembers ( ctx , groupID , [ ] string { userID } )
members , err := g . getGroupMembers ( ctx , groupID , [ ] string { userID } )
if err != nil {
if err != nil {
return nil , err
return nil , err
@ -181,7 +191,7 @@ func (g *GroupNotificationSender) getGroupMember(ctx context.Context, groupID st
return members [ 0 ] , nil
return members [ 0 ] , nil
}
}
func ( g * Group NotificationSender) getGroupOwnerAndAdminUserID ( ctx context . Context , groupID string ) ( [ ] string , error ) {
func ( g * NotificationSender) getGroupOwnerAndAdminUserID ( ctx context . Context , groupID string ) ( [ ] string , error ) {
members , err := g . db . FindGroupMemberRoleLevels ( ctx , groupID , [ ] int32 { constant . GroupOwner , constant . GroupAdmin } )
members , err := g . db . FindGroupMemberRoleLevels ( ctx , groupID , [ ] int32 { constant . GroupOwner , constant . GroupAdmin } )
if err != nil {
if err != nil {
return nil , err
return nil , err
@ -193,7 +203,7 @@ func (g *GroupNotificationSender) getGroupOwnerAndAdminUserID(ctx context.Contex
return datautil . Slice ( members , fn ) , nil
return datautil . Slice ( members , fn ) , nil
}
}
func ( g * Group NotificationSender) groupMemberDB2PB ( member * model . GroupMember , appMangerLevel int32 ) * sdkws . GroupMemberFullInfo {
func ( g * NotificationSender) groupMemberDB2PB ( member * model . GroupMember , appMangerLevel int32 ) * sdkws . GroupMemberFullInfo {
return & sdkws . GroupMemberFullInfo {
return & sdkws . GroupMemberFullInfo {
GroupID : member . GroupID ,
GroupID : member . GroupID ,
UserID : member . UserID ,
UserID : member . UserID ,
@ -210,7 +220,7 @@ func (g *GroupNotificationSender) groupMemberDB2PB(member *model.GroupMember, ap
}
}
}
}
/ * func ( g * Group NotificationSender) getUsersInfoMap ( ctx context . Context , userIDs [ ] string ) ( map [ string ] * sdkws . UserInfo , error ) {
/ * func ( g * NotificationSender) getUsersInfoMap ( ctx context . Context , userIDs [ ] string ) ( map [ string ] * sdkws . UserInfo , error ) {
users , err := g . getUsersInfo ( ctx , userIDs )
users , err := g . getUsersInfo ( ctx , userIDs )
if err != nil {
if err != nil {
return nil , err
return nil , err
@ -222,11 +232,11 @@ func (g *GroupNotificationSender) groupMemberDB2PB(member *model.GroupMember, ap
return result , nil
return result , nil
} * /
} * /
func ( g * Group NotificationSender) fillOpUser ( ctx context . Context , opUser * * sdkws . GroupMemberFullInfo , groupID string ) ( err error ) {
func ( g * NotificationSender) fillOpUser ( ctx context . Context , opUser * * sdkws . GroupMemberFullInfo , groupID string ) ( err error ) {
return g . fillOpUserByUserID ( ctx , mcontext . GetOpUserID ( ctx ) , opUser , groupID )
return g . fillOpUserByUserID ( ctx , mcontext . GetOpUserID ( ctx ) , opUser , groupID )
}
}
func ( g * Group NotificationSender) fillOpUserByUserID ( ctx context . Context , userID string , opUser * * sdkws . GroupMemberFullInfo , groupID string ) error {
func ( g * NotificationSender) 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" )
}
}
@ -270,7 +280,7 @@ func (g *GroupNotificationSender) fillOpUserByUserID(ctx context.Context, userID
return nil
return nil
}
}
func ( g * Group NotificationSender) setVersion ( ctx context . Context , version * uint64 , versionID * string , collName string , id string ) {
func ( g * NotificationSender) setVersion ( ctx context . Context , version * uint64 , versionID * string , collName string , id string ) {
versions := versionctx . GetVersionLog ( ctx ) . Get ( )
versions := versionctx . GetVersionLog ( ctx ) . Get ( )
for _ , coll := range versions {
for _ , coll := range versions {
if coll . Name == collName && coll . Doc . DID == id {
if coll . Name == collName && coll . Doc . DID == id {
@ -281,7 +291,7 @@ func (g *GroupNotificationSender) setVersion(ctx context.Context, version *uint6
}
}
}
}
func ( g * Group NotificationSender) setSortVersion ( ctx context . Context , version * uint64 , versionID * string , collName string , id string , sortVersion * uint64 ) {
func ( g * NotificationSender) setSortVersion ( ctx context . Context , version * uint64 , versionID * string , collName string , id string , sortVersion * uint64 ) {
versions := versionctx . GetVersionLog ( ctx ) . Get ( )
versions := versionctx . GetVersionLog ( ctx ) . Get ( )
for _ , coll := range versions {
for _ , coll := range versions {
if coll . Name == collName && coll . Doc . DID == id {
if coll . Name == collName && coll . Doc . DID == id {
@ -296,7 +306,7 @@ func (g *GroupNotificationSender) setSortVersion(ctx context.Context, version *u
}
}
}
}
func ( g * Group NotificationSender) GroupCreatedNotification ( ctx context . Context , tips * sdkws . GroupCreatedTips ) {
func ( g * NotificationSender) GroupCreatedNotification ( ctx context . Context , tips * sdkws . GroupCreatedTips ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -310,7 +320,7 @@ func (g *GroupNotificationSender) GroupCreatedNotification(ctx context.Context,
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , tips . Group . GroupID , constant . GroupCreatedNotification , tips )
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , tips . Group . GroupID , constant . GroupCreatedNotification , tips )
}
}
func ( g * Group NotificationSender) GroupInfoSetNotification ( ctx context . Context , tips * sdkws . GroupInfoSetTips ) {
func ( g * NotificationSender) GroupInfoSetNotification ( ctx context . Context , tips * sdkws . GroupInfoSetTips ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -324,7 +334,7 @@ func (g *GroupNotificationSender) GroupInfoSetNotification(ctx context.Context,
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , tips . Group . GroupID , constant . GroupInfoSetNotification , tips , rpcclient . WithRpcGetUserName ( ) )
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , tips . Group . GroupID , constant . GroupInfoSetNotification , tips , rpcclient . WithRpcGetUserName ( ) )
}
}
func ( g * Group NotificationSender) GroupInfoSetNameNotification ( ctx context . Context , tips * sdkws . GroupInfoSetNameTips ) {
func ( g * NotificationSender) GroupInfoSetNameNotification ( ctx context . Context , tips * sdkws . GroupInfoSetNameTips ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -338,7 +348,7 @@ func (g *GroupNotificationSender) GroupInfoSetNameNotification(ctx context.Conte
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , tips . Group . GroupID , constant . GroupInfoSetNameNotification , tips )
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , tips . Group . GroupID , constant . GroupInfoSetNameNotification , tips )
}
}
func ( g * Group NotificationSender) GroupInfoSetAnnouncementNotification ( ctx context . Context , tips * sdkws . GroupInfoSetAnnouncementTips ) {
func ( g * NotificationSender) GroupInfoSetAnnouncementNotification ( ctx context . Context , tips * sdkws . GroupInfoSetAnnouncementTips ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -352,7 +362,7 @@ func (g *GroupNotificationSender) GroupInfoSetAnnouncementNotification(ctx conte
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , tips . Group . GroupID , constant . GroupInfoSetAnnouncementNotification , tips , rpcclient . WithRpcGetUserName ( ) )
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , tips . Group . GroupID , constant . GroupInfoSetAnnouncementNotification , tips , rpcclient . WithRpcGetUserName ( ) )
}
}
func ( g * Group NotificationSender) JoinGroupApplicationNotification ( ctx context . Context , req * pbgroup . JoinGroupReq ) {
func ( g * NotificationSender) JoinGroupApplicationNotification ( ctx context . Context , req * pbgroup . JoinGroupReq ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -380,7 +390,7 @@ func (g *GroupNotificationSender) JoinGroupApplicationNotification(ctx context.C
}
}
}
}
func ( g * Group NotificationSender) MemberQuitNotification ( ctx context . Context , member * sdkws . GroupMemberFullInfo ) {
func ( g * NotificationSender) MemberQuitNotification ( ctx context . Context , member * sdkws . GroupMemberFullInfo ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -397,7 +407,7 @@ func (g *GroupNotificationSender) MemberQuitNotification(ctx context.Context, me
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , member . GroupID , constant . MemberQuitNotification , tips )
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , member . GroupID , constant . MemberQuitNotification , tips )
}
}
func ( g * Group NotificationSender) GroupApplicationAcceptedNotification ( ctx context . Context , req * pbgroup . GroupApplicationResponseReq ) {
func ( g * NotificationSender) GroupApplicationAcceptedNotification ( ctx context . Context , req * pbgroup . GroupApplicationResponseReq ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -430,7 +440,7 @@ func (g *GroupNotificationSender) GroupApplicationAcceptedNotification(ctx conte
}
}
}
}
func ( g * Group NotificationSender) GroupApplicationRejectedNotification ( ctx context . Context , req * pbgroup . GroupApplicationResponseReq ) {
func ( g * NotificationSender) GroupApplicationRejectedNotification ( ctx context . Context , req * pbgroup . GroupApplicationResponseReq ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -463,7 +473,7 @@ func (g *GroupNotificationSender) GroupApplicationRejectedNotification(ctx conte
}
}
}
}
func ( g * Group NotificationSender) GroupOwnerTransferredNotification ( ctx context . Context , req * pbgroup . TransferGroupOwnerReq ) {
func ( g * NotificationSender) GroupOwnerTransferredNotification ( ctx context . Context , req * pbgroup . TransferGroupOwnerReq ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -494,7 +504,7 @@ func (g *GroupNotificationSender) GroupOwnerTransferredNotification(ctx context.
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , group . GroupID , constant . GroupOwnerTransferredNotification , tips )
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , group . GroupID , constant . GroupOwnerTransferredNotification , tips )
}
}
func ( g * Group NotificationSender) MemberKickedNotification ( ctx context . Context , tips * sdkws . MemberKickedTips ) {
func ( g * NotificationSender) MemberKickedNotification ( ctx context . Context , tips * sdkws . MemberKickedTips ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -508,7 +518,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 * Group NotificationSender) GroupApplicationAgreeMemberEnterNotification ( ctx context . Context , groupID string , invitedOpUserID string , entrantUserID ... string ) error {
func ( g * NotificationSender) 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 {
@ -518,26 +528,15 @@ func (g *GroupNotificationSender) GroupApplicationAgreeMemberEnterNotification(c
if ! g . config . RpcConfig . EnableHistoryForNewMembers {
if ! g . config . RpcConfig . EnableHistoryForNewMembers {
conversationID := msgprocessor . GetConversationIDBySessionType ( constant . ReadGroupChatType , groupID )
conversationID := msgprocessor . GetConversationIDBySessionType ( constant . ReadGroupChatType , groupID )
maxSeq , err := rpccall . ExtractField ( ctx , msg . GetConversationMaxSeqCaller . Invoke ,
maxSeq , err := g . msgClient . GetConversationMaxSeq ( ctx , conversationID )
& msg . GetConversationMaxSeqReq { ConversationID : conversationID } ,
( * msg . GetConversationMaxSeqResp ) . GetMaxSeq )
if err != nil {
if err != nil {
return err
return err
}
}
if err := g . msgClient . SetUserConversationsMinSeq ( ctx , conversationID , entrantUserID , maxSeq ) ; err != nil {
if err := msg . SetUserConversationsMinSeqCaller . Execute ( ctx , & msg . SetUserConversationsMinSeqReq {
UserIDs : entrantUserID ,
ConversationID : conversationID ,
Seq : maxSeq ,
} ) ; err != nil {
return err
return err
}
}
}
}
if err := g . conversationClient . CreateGroupChatConversations ( ctx , groupID , entrantUserID ) ; err != nil {
if err := pbconv . CreateGroupChatConversationsCaller . Execute ( ctx , & pbconv . CreateGroupChatConversationsReq {
UserIDs : entrantUserID ,
GroupID : groupID ,
} ) ; err != nil {
return err
return err
}
}
@ -573,7 +572,7 @@ func (g *GroupNotificationSender) GroupApplicationAgreeMemberEnterNotification(c
return nil
return nil
}
}
func ( g * Group NotificationSender) MemberEnterNotification ( ctx context . Context , groupID string , entrantUserID string ) error {
func ( g * NotificationSender) MemberEnterNotification ( ctx context . Context , groupID string , entrantUserID string ) error {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -583,28 +582,17 @@ func (g *GroupNotificationSender) MemberEnterNotification(ctx context.Context, g
if ! g . config . RpcConfig . EnableHistoryForNewMembers {
if ! g . config . RpcConfig . EnableHistoryForNewMembers {
conversationID := msgprocessor . GetConversationIDBySessionType ( constant . ReadGroupChatType , groupID )
conversationID := msgprocessor . GetConversationIDBySessionType ( constant . ReadGroupChatType , groupID )
maxSeq , err := rpccall . ExtractField ( ctx , msg . GetConversationMaxSeqCaller . Invoke ,
maxSeq , err := g . msgClient . GetConversationMaxSeq ( ctx , conversationID )
& msg . GetConversationMaxSeqReq { ConversationID : conversationID } ,
( * msg . GetConversationMaxSeqResp ) . GetMaxSeq )
if err != nil {
if err != nil {
return err
return err
}
}
if err := msg . SetUserConversationsMinSeqCaller . Execute ( ctx , & msg . SetUserConversationsMinSeqReq {
if err := g . msgClient . SetUserConversationsMinSeq ( ctx , conversationID , [ ] string { entrantUserID } , maxSeq ) ; err != nil {
UserIDs : [ ] string { entrantUserID } ,
ConversationID : conversationID ,
Seq : maxSeq ,
} ) ; err != nil {
return err
return err
}
}
}
}
if err := g . conversationClient . CreateGroupChatConversations ( ctx , groupID , [ ] string { entrantUserID } ) ; err != nil {
if err := pbconv . CreateGroupChatConversationsCaller . Execute ( ctx , & pbconv . CreateGroupChatConversationsReq {
UserIDs : [ ] string { entrantUserID } ,
GroupID : groupID ,
} ) ; err != nil {
return err
return err
}
}
var group * sdkws . GroupInfo
var group * sdkws . GroupInfo
group , err = g . getGroupInfo ( ctx , groupID )
group , err = g . getGroupInfo ( ctx , groupID )
if err != nil {
if err != nil {
@ -625,7 +613,7 @@ func (g *GroupNotificationSender) MemberEnterNotification(ctx context.Context, g
return nil
return nil
}
}
func ( g * Group NotificationSender) GroupDismissedNotification ( ctx context . Context , tips * sdkws . GroupDismissedTips ) {
func ( g * NotificationSender) GroupDismissedNotification ( ctx context . Context , tips * sdkws . GroupDismissedTips ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -638,7 +626,7 @@ func (g *GroupNotificationSender) GroupDismissedNotification(ctx context.Context
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , tips . Group . GroupID , constant . GroupDismissedNotification , tips )
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , tips . Group . GroupID , constant . GroupDismissedNotification , tips )
}
}
func ( g * Group NotificationSender) GroupMemberMutedNotification ( ctx context . Context , groupID , groupMemberUserID string , mutedSeconds uint32 ) {
func ( g * NotificationSender) GroupMemberMutedNotification ( ctx context . Context , groupID , groupMemberUserID string , mutedSeconds uint32 ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -666,7 +654,7 @@ func (g *GroupNotificationSender) GroupMemberMutedNotification(ctx context.Conte
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , group . GroupID , constant . GroupMemberMutedNotification , tips )
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , group . GroupID , constant . GroupMemberMutedNotification , tips )
}
}
func ( g * Group NotificationSender) GroupMemberCancelMutedNotification ( ctx context . Context , groupID , groupMemberUserID string ) {
func ( g * NotificationSender) GroupMemberCancelMutedNotification ( ctx context . Context , groupID , groupMemberUserID string ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -691,7 +679,7 @@ func (g *GroupNotificationSender) GroupMemberCancelMutedNotification(ctx context
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , group . GroupID , constant . GroupMemberCancelMutedNotification , tips )
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , group . GroupID , constant . GroupMemberCancelMutedNotification , tips )
}
}
func ( g * Group NotificationSender) GroupMutedNotification ( ctx context . Context , groupID string ) {
func ( g * NotificationSender) GroupMutedNotification ( ctx context . Context , groupID string ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -719,7 +707,7 @@ func (g *GroupNotificationSender) GroupMutedNotification(ctx context.Context, gr
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , group . GroupID , constant . GroupMutedNotification , tips )
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , group . GroupID , constant . GroupMutedNotification , tips )
}
}
func ( g * Group NotificationSender) GroupCancelMutedNotification ( ctx context . Context , groupID string ) {
func ( g * NotificationSender) GroupCancelMutedNotification ( ctx context . Context , groupID string ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -747,7 +735,7 @@ func (g *GroupNotificationSender) GroupCancelMutedNotification(ctx context.Conte
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , group . GroupID , constant . GroupCancelMutedNotification , tips )
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , group . GroupID , constant . GroupCancelMutedNotification , tips )
}
}
func ( g * Group NotificationSender) GroupMemberInfoSetNotification ( ctx context . Context , groupID , groupMemberUserID string ) {
func ( g * NotificationSender) GroupMemberInfoSetNotification ( ctx context . Context , groupID , groupMemberUserID string ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -772,7 +760,7 @@ func (g *GroupNotificationSender) GroupMemberInfoSetNotification(ctx context.Con
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , group . GroupID , constant . GroupMemberInfoSetNotification , tips )
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , group . GroupID , constant . GroupMemberInfoSetNotification , tips )
}
}
func ( g * Group NotificationSender) GroupMemberSetToAdminNotification ( ctx context . Context , groupID , groupMemberUserID string ) {
func ( g * NotificationSender) GroupMemberSetToAdminNotification ( ctx context . Context , groupID , groupMemberUserID string ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {
@ -796,7 +784,7 @@ func (g *GroupNotificationSender) GroupMemberSetToAdminNotification(ctx context.
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , group . GroupID , constant . GroupMemberSetToAdminNotification , tips )
g . Notification ( ctx , mcontext . GetOpUserID ( ctx ) , group . GroupID , constant . GroupMemberSetToAdminNotification , tips )
}
}
func ( g * Group NotificationSender) GroupMemberSetToOrdinaryUserNotification ( ctx context . Context , groupID , groupMemberUserID string ) {
func ( g * NotificationSender) GroupMemberSetToOrdinaryUserNotification ( ctx context . Context , groupID , groupMemberUserID string ) {
var err error
var err error
defer func ( ) {
defer func ( ) {
if err != nil {
if err != nil {