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(recommend): redirect unauth users from recommend page
ferrischi2018142d78e1071
diff --git a/internal/controller/question_controller.go b/internal/controller/question_controller.goindex 725a24af..5ddc33f3 100644--- a/internal/controller/question_controller.go+++ b/internal/controller/question_controller.go@@ -340,6 +340,15 @@ func (qc *QuestionController) QuestionPage(ctx *gin.Context) {handler.HandleResponse(ctx, nil, pager.NewPageModel(total, questions))}+// QuestionRecommendPage get recommend questions by page+// @Summary get recommend questions by page+// @Description get recommend questions by page+// @Tags Question+// @Accept json+// @Produce json+// @Param data body schema.QuestionPageReq true "QuestionPageReq"+// @Success 200 {object} handler.RespBody{data=pager.PageModel{list=[]schema.QuestionPageResp}}+// @Router /answer/api/v1/question/recommend/page [get]func (qc *QuestionController) QuestionRecommendPage(ctx *gin.Context) {req := &schema.QuestionPageReq{}if handler.BindAndCheck(ctx, req) {@@ -347,6 +356,11 @@ func (qc *QuestionController) QuestionRecommendPage(ctx *gin.Context) {}req.LoginUserID = middleware.GetLoginUserIDFromContext(ctx)+ if req.LoginUserID == "" {+ handler.HandleResponse(ctx, errors.Unauthorized(reason.UnauthorizedError), nil)+ return+ }+questions, total, err := qc.questionService.GetRecommendQuestionPage(ctx, req)if err != nil {handler.HandleResponse(ctx, err, nil)