Skip to content

Commit

Permalink
fix: online notifications do not push to herself.
Browse files Browse the repository at this point in the history
  • Loading branch information
FGadvancer committed Dec 15, 2023
1 parent 7ca764d commit 6dd625c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
20 changes: 10 additions & 10 deletions internal/rpc/msg/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,16 @@ func (m *msgServer) sendMsgSingleChat(ctx context.Context, req *pbmsg.SendMsgReq
isSend := true
isNotification := msgprocessor.IsNotificationByMsg(req.MsgData)
if !isNotification {
isSend, err = m.modifyMessageByUserMessageReceiveOpt(
ctx,
req.MsgData.RecvID,
utils.GenConversationIDForSingle(req.MsgData.SendID, req.MsgData.RecvID),
constant.SingleChatType,
req,
)
if err != nil {
return nil, err
}
//isSend, err = m.modifyMessageByUserMessageReceiveOpt(
// ctx,
// req.MsgData.RecvID,
// utils.GenConversationIDForSingle(req.MsgData.SendID, req.MsgData.RecvID),
// constant.SingleChatType,
// req,
//)
//if err != nil {
// return nil, err
//}
}
if !isSend {
prommetrics.SingleChatMsgProcessFailedCounter.Inc()
Expand Down
34 changes: 17 additions & 17 deletions internal/rpc/msg/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@ func (m *msgServer) messageVerification(ctx context.Context, data *msg.SendMsgRe
data.MsgData.ContentType >= constant.NotificationBegin {
return nil
}
black, err := m.friend.IsBlocked(ctx, data.MsgData.SendID, data.MsgData.RecvID)
if err != nil {
return err
}
if black {
return errs.ErrBlockedByPeer.Wrap()
}
if *config.Config.MessageVerify.FriendVerify {
friend, err := m.friend.IsFriend(ctx, data.MsgData.SendID, data.MsgData.RecvID)
if err != nil {
return err
}
if !friend {
return errs.ErrNotPeersFriend.Wrap()
}
return nil
}
//black, err := m.friend.IsBlocked(ctx, data.MsgData.SendID, data.MsgData.RecvID)
//if err != nil {
// return err
//}
//if black {
// return errs.ErrBlockedByPeer.Wrap()
//}
//if *config.Config.MessageVerify.FriendVerify {
// friend, err := m.friend.IsFriend(ctx, data.MsgData.SendID, data.MsgData.RecvID)
// if err != nil {
// return err
// }
// if !friend {
// return errs.ErrNotPeersFriend.Wrap()
// }
// return nil
//}
return nil
case constant.SuperGroupChatType:
groupInfo, err := m.Group.GetGroupInfoCache(ctx, data.MsgData.GroupID)
Expand Down

0 comments on commit 6dd625c

Please sign in to comment.