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(question): Incorrect empty query condition in postgres causes query problem bug. Fix #148
LinkinStar640ae6e3b956
diff --git a/i18n/en_US.yaml b/i18n/en_US.yamlindex f249dc08..d5ecb88e 100644--- a/i18n/en_US.yaml+++ b/i18n/en_US.yaml@@ -135,21 +135,21 @@ backend:other: "Username is already in use."set_avatar:other: "Avatar set failed."- config:- read_config_failed:- other: "Read config failed"- database:- connection_failed:- other: "Database connection failed"- create_table_failed:- other: "Create table failed"- install:- create_config_failed:- other: "Can’t create the config.yaml file."cannot_update_your_role:other: "You cannot modify your role."not_allowed_registration:other: "Currently the site is not open for registration"+ config:+ read_config_failed:+ other: "Read config failed"+ database:+ connection_failed:+ other: "Database connection failed"+ create_table_failed:+ other: "Create table failed"+ install:+ create_config_failed:+ other: "Can’t create the config.yaml file."report:spam:name:diff --git a/internal/service/question_common/question.go b/internal/service/question_common/question.goindex f9fb6b07..3a525b89 100644--- a/internal/service/question_common/question.go+++ b/internal/service/question_common/question.go@@ -190,9 +190,15 @@ func (qs *QuestionCommon) Info(ctx context.Context, questionID string, loginUsershowinfo.Tags = tagmapuserIds := make([]string, 0)- userIds = append(userIds, dbinfo.UserID)- userIds = append(userIds, dbinfo.LastEditUserID)- userIds = append(userIds, showinfo.LastAnsweredUserID)+ if checker.IsNotZeroString(dbinfo.UserID) {+ userIds = append(userIds, dbinfo.UserID)+ }+ if checker.IsNotZeroString(dbinfo.LastEditUserID) {+ userIds = append(userIds, dbinfo.LastEditUserID)+ }+ if checker.IsNotZeroString(showinfo.LastAnsweredUserID) {+ userIds = append(userIds, showinfo.LastAnsweredUserID)+ }userInfoMap, err := qs.userCommon.BatchUserBasicInfoByID(ctx, userIds)if err != nil {return showinfo, err