@@ -200,17 +200,19 @@ func (h *handler) serveChangesPattern(w http.ResponseWriter, req *http.Request,
}
// changeStateFilter parses the change state filter from query,
// returning an error if the value is unsupported.
func changeStateFilter(query url.Values) (change.StateFilter, error) {
selectedTabName := query.Get(stateQueryKey)
switch selectedTabName {
case "":
switch vs := query[stateQueryKey]; {
case len(vs) == 0,
len(vs) == 1 && vs[0] == "open":
return change.FilterOpen, nil
case "closed":
case len(vs) == 1 && vs[0] == "closed":
return change.FilterClosedMerged, nil
case "all":
case len(vs) == 1 && vs[0] == "all":
return change.FilterAll, nil
case len(vs) == 1:
return "", fmt.Errorf("unsupported state filter value: %q", vs[0])
default:
return "", fmt.Errorf("unsupported state filter value: %q", selectedTabName)
return "", fmt.Errorf("multiple state filters are not supported: %q", vs)
}
}