feat(console): add or remove all monitors of a status page, skip signup when signed in

The status page editor gets "Add all" and "Remove all" above its monitor
list. Opening the signup page while signed in leads to the monitor list,
as the login page already did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-25 23:19:27 +01:00
1 parent feaa1e930d
commit 4cde0f7e56
7 files changed
+463 -381

No files matched your search

+28
View File
@@ -55,3 +55,31 @@ func TestDashboardFiltersByStatus(t *testing.T) {
t.Error("an unknown status filter hides monitors")
}
}
func TestSignupSendsSignedInUsersToTheMonitors(t *testing.T) {
e := newEnv(t)
visitor := e.browser(t)
if st, path, _ := visitor.page("/signup"); st != http.StatusOK || path != "/signup" {
t.Fatalf("signup for a visitor = %d at %s", st, path)
}
owner := e.browser(t)
owner.signup("o@"+uniq("su")+".test", uniq("su-"))
if st, path, html := owner.page("/signup"); st != http.StatusOK || path != "/" || !strings.Contains(html, "Monitors") {
t.Errorf("signup when signed in ended at %s (%d), want the monitor list", path, st)
}
}
func TestPageEditorOffersAddAndRemoveAll(t *testing.T) {
e := newEnv(t)
_, region := e.platformChecker(t, uniq("eu-"))
owner := e.browser(t)
owner.signup("o@"+uniq("pa")+".test", uniq("pa-"))
owner.do("POST", "/api/v1/org/monitors", map[string]any{"name": "Shop", "type": "http", "target": "https://shop.test", "interval_seconds": 60, "regions": []string{region}})
_, p := owner.do("POST", "/api/v1/org/statuspages", map[string]any{"slug": uniq("pa-"), "title": "Status"})
_, _, html := owner.page("/statuspages/" + p["id"].(string))
for _, want := range []string{`data-check-all="on"`, `data-check-all="off"`, "Add all", "Remove all"} {
if !strings.Contains(html, want) {
t.Errorf("the page editor lacks %q", want)
}
}
}
+5
View File
@@ -122,6 +122,11 @@ func (s *Server) signupOptions(ctx context.Context) (bool, []web.IDPButton, erro
}
func (s *Server) signupPage(c *gin.Context) {
// Signed in already: straight to the monitors.
if auth.Current(c) != nil {
c.Redirect(http.StatusSeeOther, "/")
return
}
email, providers, err := s.signupOptions(c.Request.Context())
if err != nil {
internalError(c, err)