Say on the Profile page that drafting from the website needs an AI provider

The Draft button is disabled, with a link to Settings → AI provider,
until one is set up; the Overview lists the AI provider first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 14:54:04 -07:00
co-authored by Claude Opus 5.5
parent cd24f2a06d
commit 434a9093b0
4 changed files with 30 additions and 4 deletions
+12
View File
@@ -255,3 +255,15 @@ func TestMCPNeedsTokenAndChecksIn(t *testing.T) {
t.Fatalf("checkin not recorded: %+v %v", last, err)
}
}
func TestProfileDraftNeedsAI(t *testing.T) {
s, h := newTestServer(t, nil)
body := do(h, http.MethodGet, "/profile", nil, nil).Body.String()
if !strings.Contains(body, `<a href="/settings/ai">choose an AI provider</a>`) || !strings.Contains(body, `class="secondary" disabled>Draft`) {
t.Errorf("profile without AI:\n%s", body)
}
_ = s.Secrets.Set(map[string]string{secrets.AnthropicAPIKey: "k"})
if body := do(h, http.MethodGet, "/profile", nil, nil).Body.String(); strings.Contains(body, "choose an AI provider") {
t.Error("warning shown with an AI key saved")
}
}