Skip to content

Commit 8a835b2

Browse files
committed
ci: fix lint and test failures
1 parent 57fd799 commit 8a835b2

2 files changed

Lines changed: 33 additions & 15 deletions

File tree

backend/internal/server/api_contract_test.go

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -646,12 +646,21 @@ func TestAPIContracts(t *testing.T) {
646646
"registration_email_suffix_whitelist": [],
647647
"promo_code_enabled": true,
648648
"password_reset_enabled": false,
649-
"frontend_url": "",
650-
"totp_enabled": false,
651-
"totp_encryption_key_configured": false,
652-
"smtp_host": "smtp.example.com",
653-
"smtp_port": 587,
654-
"smtp_username": "user",
649+
"frontend_url": "",
650+
"totp_enabled": false,
651+
"totp_encryption_key_configured": false,
652+
"login_agreement_enabled": false,
653+
"login_agreement_mode": "modal",
654+
"login_agreement_updated_at": "2026-03-31",
655+
"login_agreement_documents": [
656+
{"id": "terms", "title": "服务条款", "content_md": ""},
657+
{"id": "usage-policy", "title": "使用政策", "content_md": ""},
658+
{"id": "supported-regions", "title": "支持的国家和地区", "content_md": ""},
659+
{"id": "service-specific-terms", "title": "服务特定条款", "content_md": ""}
660+
],
661+
"smtp_host": "smtp.example.com",
662+
"smtp_port": 587,
663+
"smtp_username": "user",
655664
"smtp_password_configured": true,
656665
"smtp_from_email": "no-reply@example.com",
657666
"smtp_from_name": "Sub2API",
@@ -880,12 +889,21 @@ func TestAPIContracts(t *testing.T) {
880889
"promo_code_enabled": true,
881890
"password_reset_enabled": false,
882891
"frontend_url": "",
883-
"invitation_code_enabled": false,
884-
"totp_enabled": false,
885-
"totp_encryption_key_configured": false,
886-
"smtp_host": "",
887-
"smtp_port": 587,
888-
"smtp_username": "",
892+
"invitation_code_enabled": false,
893+
"totp_enabled": false,
894+
"totp_encryption_key_configured": false,
895+
"login_agreement_enabled": false,
896+
"login_agreement_mode": "modal",
897+
"login_agreement_updated_at": "2026-03-31",
898+
"login_agreement_documents": [
899+
{"id": "terms", "title": "服务条款", "content_md": ""},
900+
{"id": "usage-policy", "title": "使用政策", "content_md": ""},
901+
{"id": "supported-regions", "title": "支持的国家和地区", "content_md": ""},
902+
{"id": "service-specific-terms", "title": "服务特定条款", "content_md": ""}
903+
],
904+
"smtp_host": "",
905+
"smtp_port": 587,
906+
"smtp_username": "",
889907
"smtp_password_configured": false,
890908
"smtp_from_email": "",
891909
"smtp_from_name": "",

backend/internal/service/setting_service.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,16 @@ func normalizeLoginAgreementDocumentID(raw string) string {
249249
lastSeparator := false
250250
for _, r := range raw {
251251
if (r >= 'a' && r <= 'z') || (r >= '0' && r <= '9') {
252-
b.WriteRune(r)
252+
_, _ = b.WriteRune(r)
253253
lastSeparator = false
254254
continue
255255
}
256256
if r == '-' || r == '_' || r == ' ' || r == '.' || r == '/' {
257257
if !lastSeparator && b.Len() > 0 {
258258
if r == '_' {
259-
b.WriteRune('_')
259+
_, _ = b.WriteRune('_')
260260
} else {
261-
b.WriteRune('-')
261+
_, _ = b.WriteRune('-')
262262
}
263263
lastSeparator = true
264264
}

0 commit comments

Comments
 (0)