fix(question): Incorrect empty query condition in postgres causes query problem bug. Fix #148

This commit is contained in:
LinkinStar 2023-01-04 10:09:37 +08:00
parent 6b9fa98e48
commit 640ae6e3b9
2 changed files with 20 additions and 14 deletions

View File

@ -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: "Cant 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: "Cant create the config.yaml file."
report:
spam:
name:

View File

@ -190,9 +190,15 @@ func (qs *QuestionCommon) Info(ctx context.Context, questionID string, loginUser
showinfo.Tags = tagmap
userIds := 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