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 1fdf7af38e9458cac895e251e94771e508224111
Author: LinkinStars <[email protected]>
AuthorDate: Mon Aug 17 11:32:39 2026 +0800

    chore: satisfy static checks
---
 internal/repo/question/question_repo.go | 7 ++++---
 internal/schema/email_template.go       | 8 ++------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/internal/repo/question/question_repo.go 
b/internal/repo/question/question_repo.go
index 3f38fc6c..379b4380 100644
--- a/internal/repo/question/question_repo.go
+++ b/internal/repo/question/question_repo.go
@@ -833,11 +833,12 @@ func (qr *questionRepo) GetQuestionLink(ctx 
context.Context, page, pageSize int,
                Distinct("question.id").
                Where("question_link.status = ?", 
entity.QuestionLinkStatusAvailable).
                Select("question.*")
-       if isAdminModerator {
+       switch {
+       case isAdminModerator:
                session.Where("question.status IN (?, ?, ?)", 
entity.QuestionStatusAvailable, entity.QuestionStatusClosed, 
entity.QuestionStatusPending)
-       } else if loginUserID != "" {
+       case loginUserID != "":
                session.Where("(question.status IN (?, ?) OR (question.status = 
? AND question.user_id = ?))", entity.QuestionStatusAvailable, 
entity.QuestionStatusClosed, entity.QuestionStatusPending, loginUserID)
-       } else {
+       default:
                session.In("question.status", 
[]int{entity.QuestionStatusAvailable, entity.QuestionStatusClosed})
        }
 
diff --git a/internal/schema/email_template.go 
b/internal/schema/email_template.go
index 57f1ac3c..e28cf90d 100644
--- a/internal/schema/email_template.go
+++ b/internal/schema/email_template.go
@@ -21,6 +21,7 @@ package schema
 
 import (
        "encoding/json"
+       "slices"
 
        "github.com/apache/answer/internal/base/constant"
 )
@@ -57,12 +58,7 @@ func (r *EmailCodeContent) FromJSONString(data string) error 
{
 }
 
 func (r *EmailCodeContent) IsSourceType(sourceTypes ...EmailSourceType) bool {
-       for _, sourceType := range sourceTypes {
-               if r.SourceType == sourceType {
-                       return true
-               }
-       }
-       return false
+       return slices.Contains(sourceTypes, r.SourceType)
 }
 
 type RegisterTemplateData struct {

Reply via email to