fix(dashboard): normalize recoverable layout preferences on save
Build and publish container images / images (push) Successful in 9m27s
Release container images / release (push) Successful in 20s

This commit is contained in:
Anya Tokugawa committed 2026-11-10 07:36:32 +09:00
1 parent 667776e43f
commit 38b0fe2a94
4 files changed
+43 -4

No files matched your search

+11 -1
View File
@@ -69,12 +69,22 @@ func TestOrganizerDashboardLayoutIsolationAndCAS(t *testing.T) {
if err = json.Unmarshal(w.Body.Bytes(), &layout); err != nil || len(layout.Widgets) != 0 {
t.Fatal("empty layout reset", layout, err)
}
for _, invalid := range [][]store.DashboardWidget{{{ID: "iframe", Width: 4, Height: 3}}, {{ID: "tasks", Width: 13, Height: 3, Tab: "inbox"}}, {{ID: "tasks", Width: 4, Height: 3, Tab: "secret"}}, {{ID: "progress", Width: 4, Height: 3}, {ID: "progress", Width: 4, Height: 3}}} {
for _, invalid := range [][]store.DashboardWidget{{{ID: "iframe", Width: 4, Height: 3}}} {
w = taskRequest(s, token, "PUT", "dashboard", map[string]any{"version": layout.Version, "widgets": invalid}, "")
if w.Code != 422 {
t.Fatal("invalid accepted", w.Code, w.Body)
}
}
for _, id := range []string{"commands", "tomorrow-schedule", "feeds"} {
input := []store.DashboardWidget{{ID: "tasks", Width: 13, Height: 0}, {ID: id, Width: 6, Height: 4, Tab: "obsolete"}, {ID: id, Width: 6, Height: 4}}
w = taskRequest(s, token, "PUT", "dashboard", map[string]any{"version": layout.Version, "widgets": input}, "")
if w.Code != 200 {
t.Fatal("normalizable layout rejected", w.Code, w.Body)
}
if err = json.Unmarshal(w.Body.Bytes(), &layout); err != nil || len(layout.Widgets) != 2 || layout.Widgets[0].Width != 12 || layout.Widgets[0].Height != 2 || layout.Widgets[0].Tab != "inbox" || layout.Widgets[1].Tab != "" {
t.Fatal("normalization", layout, err)
}
}
other, err := s.store.CreatePasswordAccount(domain, "dashboardother", "long test password", "Other", "")
if err != nil {
t.Fatal(err)