fix(comment): do not send notification when reply myself

This commit is contained in:
LinkinStar 2023-01-30 17:07:38 +08:00
parent a15a4ab22c
commit 21a354fb22
1 changed files with 2 additions and 2 deletions

View File

@ -138,7 +138,7 @@ func (cs *CommentService) AddComment(ctx context.Context, req *schema.AddComment
time.Now(), req.CanEdit, req.CanDelete)
// get reply user info
if len(resp.ReplyUserID) > 0 {
if len(resp.ReplyUserID) > 0 && resp.ReplyUserID != req.UserID {
replyUser, exist, err := cs.userCommon.GetUserBasicInfoByID(ctx, resp.ReplyUserID)
if err != nil {
return nil, err
@ -148,7 +148,7 @@ func (cs *CommentService) AddComment(ctx context.Context, req *schema.AddComment
resp.ReplyUserDisplayName = replyUser.DisplayName
resp.ReplyUserStatus = replyUser.Status
}
cs.notificationCommentReply(ctx, replyUser.ID, objInfo.QuestionID, req.UserID)
cs.notificationCommentReply(ctx, replyUser.ID, comment.ID, req.UserID)
}
// get user info