style: add format

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
Xinwei Xiong(cubxxw-openim)
2023-07-03 16:29:22 +08:00
parent 187ee9a375
commit 166ddb1e34
170 changed files with 4816 additions and 1279 deletions
+53 -8
View File
@@ -4,6 +4,8 @@ import (
"context"
"encoding/json"
"google.golang.org/protobuf/proto"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mcontext"
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
@@ -12,7 +14,6 @@ import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
"google.golang.org/protobuf/proto"
)
type ExtendMsgNotificationSender struct {
@@ -23,8 +24,16 @@ func NewExtendMsgNotificationSender(client discoveryregistry.SvcDiscoveryRegistr
return &ExtendMsgNotificationSender{}
}
func (e *ExtendMsgNotificationSender) ExtendMessageUpdatedNotification(ctx context.Context, sendID string, conversationID string, sessionType int32,
req *msg.SetMessageReactionExtensionsReq, resp *msg.SetMessageReactionExtensionsResp, isHistory bool, isReactionFromCache bool) {
func (e *ExtendMsgNotificationSender) ExtendMessageUpdatedNotification(
ctx context.Context,
sendID string,
conversationID string,
sessionType int32,
req *msg.SetMessageReactionExtensionsReq,
resp *msg.SetMessageReactionExtensionsResp,
isHistory bool,
isReactionFromCache bool,
) {
var content sdkws.ReactionMessageModifierNotification
content.ConversationID = req.ConversationID
content.OpUserID = mcontext.GetOpUserID(ctx)
@@ -43,10 +52,28 @@ func (e *ExtendMsgNotificationSender) ExtendMessageUpdatedNotification(ctx conte
content.IsReact = resp.IsReact
content.IsExternalExtensions = req.IsExternalExtensions
content.MsgFirstModifyTime = resp.MsgFirstModifyTime
e.messageReactionSender(ctx, sendID, conversationID, sessionType, constant.ReactionMessageModifier, &content, isHistory, isReactionFromCache)
e.messageReactionSender(
ctx,
sendID,
conversationID,
sessionType,
constant.ReactionMessageModifier,
&content,
isHistory,
isReactionFromCache,
)
}
func (e *ExtendMsgNotificationSender) ExtendMessageDeleteNotification(ctx context.Context, sendID string, conversationID string, sessionType int32,
req *msg.DeleteMessagesReactionExtensionsReq, resp *msg.DeleteMessagesReactionExtensionsResp, isHistory bool, isReactionFromCache bool) {
func (e *ExtendMsgNotificationSender) ExtendMessageDeleteNotification(
ctx context.Context,
sendID string,
conversationID string,
sessionType int32,
req *msg.DeleteMessagesReactionExtensionsReq,
resp *msg.DeleteMessagesReactionExtensionsResp,
isHistory bool,
isReactionFromCache bool,
) {
var content sdkws.ReactionMessageDeleteNotification
content.ConversationID = req.ConversationID
content.OpUserID = req.OpUserID
@@ -63,9 +90,27 @@ func (e *ExtendMsgNotificationSender) ExtendMessageDeleteNotification(ctx contex
content.SuccessReactionExtensions = keyMap
content.ClientMsgID = req.ClientMsgID
content.MsgFirstModifyTime = req.MsgFirstModifyTime
e.messageReactionSender(ctx, sendID, conversationID, sessionType, constant.ReactionMessageDeleter, &content, isHistory, isReactionFromCache)
e.messageReactionSender(
ctx,
sendID,
conversationID,
sessionType,
constant.ReactionMessageDeleter,
&content,
isHistory,
isReactionFromCache,
)
}
func (e *ExtendMsgNotificationSender) messageReactionSender(ctx context.Context, sendID string, conversationID string, sessionType, contentType int32, m proto.Message, isHistory bool, isReactionFromCache bool) error {
func (e *ExtendMsgNotificationSender) messageReactionSender(
ctx context.Context,
sendID string,
conversationID string,
sessionType, contentType int32,
m proto.Message,
isHistory bool,
isReactionFromCache bool,
) error {
options := make(map[string]bool, 5)
utils.SetSwitchFromOptions(options, constant.IsOfflinePush, false)
utils.SetSwitchFromOptions(options, constant.IsConversationUpdate, false)