You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by li...@apache.org on 2026/05/08 11:57:34 UTC

(answer) 09/13: fix lint

This is an automated email from the ASF dual-hosted git repository.

LinkinStars pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git

commit ac7bdda074efcc8a6122cda6f1b7af2ff04f14dd
Author: hgaol <dh...@hotmail.com>
AuthorDate: Wed Apr 22 22:21:33 2026 +0800

    fix lint
---
 internal/service/content/answer_service.go   | 5 +++--
 internal/service/content/question_service.go | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/internal/service/content/answer_service.go b/internal/service/content/answer_service.go
index 2adddd6b..9ae478fe 100644
--- a/internal/service/content/answer_service.go
+++ b/internal/service/content/answer_service.go
@@ -637,10 +637,11 @@ func (as *AnswerService) AdminSetAnswerStatus(ctx context.Context, req *schema.A
 			return err
 		}
 	}
-	if setStatus == entity.AnswerStatusDeleted {
+	switch setStatus {
+	case entity.AnswerStatusDeleted:
 		as.vectorSyncService.Send(ctx, &vector_sync.Task{Action: vector_sync.ActionDelete, ObjectType: vector_sync.ObjectTypeAnswer, ObjectID: answerInfo.ID})
 		as.vectorSyncService.Send(ctx, &vector_sync.Task{Action: vector_sync.ActionUpsert, ObjectType: vector_sync.ObjectTypeQuestion, ObjectID: answerInfo.QuestionID})
-	} else if setStatus == entity.AnswerStatusAvailable {
+	case entity.AnswerStatusAvailable:
 		as.vectorSyncService.Send(ctx, &vector_sync.Task{Action: vector_sync.ActionUpsert, ObjectType: vector_sync.ObjectTypeAnswer, ObjectID: answerInfo.ID})
 		as.vectorSyncService.Send(ctx, &vector_sync.Task{Action: vector_sync.ActionUpsert, ObjectType: vector_sync.ObjectTypeQuestion, ObjectID: answerInfo.QuestionID})
 	}
diff --git a/internal/service/content/question_service.go b/internal/service/content/question_service.go
index 8b34fe48..fafb29b2 100644
--- a/internal/service/content/question_service.go
+++ b/internal/service/content/question_service.go
@@ -1639,9 +1639,10 @@ func (qs *QuestionService) AdminSetQuestionStatus(ctx context.Context, req *sche
 		msg.ObjectType = constant.QuestionObjectType
 		qs.notificationQueueService.Send(ctx, msg)
 	}
-	if setStatus == entity.QuestionStatusDeleted {
+	switch setStatus {
+	case entity.QuestionStatusDeleted:
 		qs.vectorSyncService.Send(ctx, &vector_sync.Task{Action: vector_sync.ActionDelete, ObjectType: vector_sync.ObjectTypeQuestion, ObjectID: questionInfo.ID})
-	} else if setStatus == entity.QuestionStatusAvailable {
+	case entity.QuestionStatusAvailable:
 		qs.vectorSyncService.Send(ctx, &vector_sync.Task{Action: vector_sync.ActionUpsert, ObjectType: vector_sync.ObjectTypeQuestion, ObjectID: questionInfo.ID})
 	}
 	return nil