fix(qa): 邮件设置未配置时返回空收件人数组
build / build (push) Successful in 1m14s

未初始化设置时 recipients 为 null,前端严格解析判为无效,导致周报页显示“响应无效”。
后端统一返回空数组,前端同时兼容历史的 null。
This commit is contained in:
hermes
2026-10-26 10:30:29 +08:00
parent 43b1e423fe
commit eed83039ab
2 changed files with 7 additions and 3 deletions
+4 -1
View File
@@ -217,7 +217,7 @@ func normalize(input SettingsInput) (SettingsInput, error) {
}
func (s *Store) ReadSettings(ctx context.Context) (Settings, error) {
out := Settings{Port: 465, Weekday: 1, Hour: 9}
out := Settings{Port: 465, Weekday: 1, Hour: 9, Recipients: []string{}}
if !s.valid() {
return out, ErrUnavailable
}
@@ -230,6 +230,9 @@ func (s *Store) ReadSettings(ctx context.Context) (Settings, error) {
if err != nil {
return Settings{}, ErrUnavailable
}
if out.Recipients == nil {
out.Recipients = []string{}
}
out.HasPassword = len(sealed) > 0
return out, nil
}