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: update the visit cookie if it does not match the visit token
Giorgio Bonvicini6381a2192e9a
diff --git a/internal/controller/user_controller.go b/internal/controller/user_controller.goindex c8ffd7fe..49b9b23c 100644--- a/internal/controller/user_controller.go+++ b/internal/controller/user_controller.go@@ -717,9 +717,12 @@ func (uc *UserController) SearchUserListByName(ctx *gin.Context) {}func (uc *UserController) setVisitCookies(ctx *gin.Context, visitToken string, force bool) {- cookie, err := ctx.Cookie(constant.UserVisitCookiesCacheKey)- if err == nil && len(cookie) > 0 && !force {- return+ if !force {+ cookie, _ := ctx.Cookie(constant.UserVisitCookiesCacheKey)+ // If the cookie is the same as the visitToken, no need to set it again+ if cookie == visitToken {+ return+ }}general, err := uc.siteInfoCommonService.GetSiteGeneral(ctx)if err != nil {