Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat/1.2.0/img' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkinStars committed Oct 13, 2023
2 parents b8bd4b0 + 9e9fb89 commit 359cb32
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/controller/user_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (uc *UserController) GetUserInfoByUserID(ctx *gin.Context) {
}

resp, err := uc.userService.GetUserInfoByUserID(ctx, token, userInfo.UserID)
uc.setVisitCookies(ctx, userInfo.VisitToken)
uc.setVisitCookies(ctx, userInfo.VisitToken, false)
handler.HandleResponse(ctx, err, resp)
}

Expand Down Expand Up @@ -139,7 +139,7 @@ func (uc *UserController) UserEmailLogin(ctx *gin.Context) {
if !isAdmin {
uc.actionService.ActionRecordDel(ctx, entity.CaptchaActionPassword, ctx.ClientIP())
}
uc.setVisitCookies(ctx, resp.VisitToken)
uc.setVisitCookies(ctx, resp.VisitToken, true)
handler.HandleResponse(ctx, nil, resp)
}

Expand Down Expand Up @@ -680,9 +680,9 @@ func (uc *UserController) SearchUserListByName(ctx *gin.Context) {
handler.HandleResponse(ctx, err, resp)
}

func (uc *UserController) setVisitCookies(ctx *gin.Context, visitToken string) {
func (uc *UserController) setVisitCookies(ctx *gin.Context, visitToken string, force bool) {
cookie, err := ctx.Cookie(constant.UserVisitCookiesCacheKey)
if err == nil && len(cookie) > 0 {
if err == nil && len(cookie) > 0 && !force {
return
}
general, err := uc.siteInfoCommonService.GetSiteGeneral(ctx)
Expand Down
1 change: 1 addition & 0 deletions internal/service/answer_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ func (as *AnswerService) AdminSetAnswerStatus(ctx context.Context, req *schema.A
//}
as.activityQueueService.Send(ctx, &schema.ActivityMsg{
UserID: req.UserID,
TriggerUserID: converter.StringToInt64(req.UserID),
ObjectID: answerInfo.ID,
OriginalObjectID: answerInfo.ID,
ActivityTypeKey: constant.ActAnswerDeleted,
Expand Down
3 changes: 3 additions & 0 deletions internal/service/question_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,7 @@ func (qs *QuestionService) AdminSetQuestionStatus(ctx context.Context, req *sche
//}
qs.activityQueueService.Send(ctx, &schema.ActivityMsg{
UserID: questionInfo.UserID,
TriggerUserID: converter.StringToInt64(req.UserID),
ObjectID: questionInfo.ID,
OriginalObjectID: questionInfo.ID,
ActivityTypeKey: constant.ActQuestionDeleted,
Expand All @@ -1290,6 +1291,7 @@ func (qs *QuestionService) AdminSetQuestionStatus(ctx context.Context, req *sche
if setStatus == entity.QuestionStatusAvailable && questionInfo.Status == entity.QuestionStatusClosed {
qs.activityQueueService.Send(ctx, &schema.ActivityMsg{
UserID: questionInfo.UserID,
TriggerUserID: converter.StringToInt64(req.UserID),
ObjectID: questionInfo.ID,
OriginalObjectID: questionInfo.ID,
ActivityTypeKey: constant.ActQuestionReopened,
Expand All @@ -1298,6 +1300,7 @@ func (qs *QuestionService) AdminSetQuestionStatus(ctx context.Context, req *sche
if setStatus == entity.QuestionStatusClosed && questionInfo.Status != entity.QuestionStatusClosed {
qs.activityQueueService.Send(ctx, &schema.ActivityMsg{
UserID: questionInfo.UserID,
TriggerUserID: converter.StringToInt64(req.UserID),
ObjectID: questionInfo.ID,
OriginalObjectID: questionInfo.ID,
ActivityTypeKey: constant.ActQuestionClosed,
Expand Down

0 comments on commit 359cb32

Please sign in to comment.