This is an automated email from the ASF dual-hosted git repository. shuai pushed a commit to branch dev in repository https://gitbox.apache.org/repos/asf/answer.git
commit 3ae38a14f09a42a5cf0b3dc9ca7f187517d33604 Author: Dinesht04 <[email protected]> AuthorDate: Sat Oct 11 02:50:31 2025 +0530 feat(UI): Add error for minimum_tag count and translation for Min tag form input --- i18n/en_US.yaml | 5 +++++ internal/base/reason/reason.go | 1 + internal/service/content/question_service.go | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml index bec2775c..d7b56d8c 100644 --- a/i18n/en_US.yaml +++ b/i18n/en_US.yaml @@ -264,6 +264,8 @@ backend: other: You cannot delete a tag that is in use. cannot_set_synonym_as_itself: other: You cannot set the synonym of the current tag as itself. + minimum_count: + other: Not enough tags were entered. smtp: config_from_name_cannot_be_email: other: The from name cannot be a email address. @@ -2122,6 +2124,9 @@ ui: title: Answer write label: Each user can only write one answer for the same question text: "Turn off to allow users to write multiple answers to the same question, which may cause answers to be unfocused." + min_tags: + label: "Minimum tags per question" + text: "Minimum number of tags required in a question" recommend_tags: label: Recommend tags text: "Recommend tags will show in the dropdown list by default." diff --git a/internal/base/reason/reason.go b/internal/base/reason/reason.go index 953c316e..5a34d921 100644 --- a/internal/base/reason/reason.go +++ b/internal/base/reason/reason.go @@ -77,6 +77,7 @@ const ( TagCannotUpdate = "error.tag.cannot_update" TagIsUsedCannotDelete = "error.tag.is_used_cannot_delete" TagAlreadyExist = "error.tag.already_exist" + TagMinCount = "error.tag.minimum_count" RankFailToMeetTheCondition = "error.rank.fail_to_meet_the_condition" VoteRankFailToMeetTheCondition = "error.rank.vote_fail_to_meet_the_condition" NoEnoughRankToOperate = "error.rank.no_enough_rank_to_operate" diff --git a/internal/service/content/question_service.go b/internal/service/content/question_service.go index 610cc10d..39342313 100644 --- a/internal/service/content/question_service.go +++ b/internal/service/content/question_service.go @@ -237,7 +237,7 @@ func (qs *QuestionService) CheckAddQuestion(ctx context.Context, req *schema.Que errorlist := make([]*validator.FormErrorField, 0) errorlist = append(errorlist, &validator.FormErrorField{ ErrorField: "tags", - ErrorMsg: translator.Tr(handler.GetLangByCtx(ctx), reason.TagNotFound), + ErrorMsg: translator.Tr(handler.GetLangByCtx(ctx), reason.TagMinCount), }) err = errors.BadRequest(reason.RecommendTagEnter) return errorlist, err @@ -296,7 +296,7 @@ func (qs *QuestionService) AddQuestion(ctx context.Context, req *schema.Question errorlist := make([]*validator.FormErrorField, 0) errorlist = append(errorlist, &validator.FormErrorField{ ErrorField: "tags", - ErrorMsg: translator.Tr(handler.GetLangByCtx(ctx), reason.TagNotFound), + ErrorMsg: translator.Tr(handler.GetLangByCtx(ctx), reason.TagMinCount), }) err = errors.BadRequest(reason.RecommendTagEnter) return errorlist, err
