From 00e4f2c9dec913067ed5e996390479d9e8fc6dbb Mon Sep 17 00:00:00 2001 From: LinkinStar Date: Mon, 30 Jan 2023 17:07:38 +0800 Subject: [PATCH 1/2] fix(comment): do not send notification when reply myself --- internal/service/comment/comment_service.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/comment/comment_service.go b/internal/service/comment/comment_service.go index b308a808..cb45c7d1 100644 --- a/internal/service/comment/comment_service.go +++ b/internal/service/comment/comment_service.go @@ -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 From c1fa2b13f6b547b96da60b23350bbe2b29de542d Mon Sep 17 00:00:00 2001 From: aichy126 <16996097+aichy126@users.noreply.github.com> Date: Tue, 31 Jan 2023 10:04:52 +0800 Subject: [PATCH 2/2] fix RetrievePassWord code --- internal/controller/user_controller.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/controller/user_controller.go b/internal/controller/user_controller.go index 909581cc..c2cf25bf 100644 --- a/internal/controller/user_controller.go +++ b/internal/controller/user_controller.go @@ -157,8 +157,8 @@ func (uc *UserController) RetrievePassWord(ctx *gin.Context) { return } _, _ = uc.actionService.ActionRecordAdd(ctx, schema.ActionRecordTypeFindPass, ctx.ClientIP()) - code, err := uc.userService.RetrievePassWord(ctx, req) - handler.HandleResponse(ctx, err, code) + _, err := uc.userService.RetrievePassWord(ctx, req) + handler.HandleResponse(ctx, err, nil) } // UseRePassWord godoc