A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix question userid
aichy126de5b2966bf31
diff --git a/internal/service/answer_service.go b/internal/service/answer_service.goindex 78d727dc..2e9020e7 100644--- a/internal/service/answer_service.go+++ b/internal/service/answer_service.go@@ -224,6 +224,7 @@ func (as *AnswerService) Update(ctx context.Context, req *schema.AnswerUpdateReqnow := time.Now()insertData := new(entity.Answer)insertData.ID = req.ID+ insertData.UserID = answerInfo.UserIDinsertData.QuestionID = req.QuestionIDinsertData.OriginalText = req.ContentinsertData.ParsedText = req.HTMLdiff --git a/internal/service/question_service.go b/internal/service/question_service.goindex 37178a5a..6997109e 100644--- a/internal/service/question_service.go+++ b/internal/service/question_service.go@@ -282,6 +282,14 @@ func (qs *QuestionService) UpdateQuestion(ctx context.Context, req *schema.Questreturn}+ dbinfo, has, err := qs.questionRepo.GetQuestion(ctx, req.ID)+ if err != nil {+ return+ }+ if !has {+ return+ }+now := time.Now()question := &entity.Question{}question.Title = req.Title@@ -290,13 +298,8 @@ func (qs *QuestionService) UpdateQuestion(ctx context.Context, req *schema.Questquestion.ID = req.IDquestion.UpdatedAt = nowquestion.PostUpdateTime = now- dbinfo, has, err := qs.questionRepo.GetQuestion(ctx, question.ID)- if err != nil {- return- }- if !has {- return- }+ question.UserID = dbinfo.UserID+question.LastEditUserID = "0"if dbinfo.UserID != req.UserID {question.LastEditUserID = req.UserID