Fix filtering deprecated tempalte params

This commit is contained in:
andig 2025-08-25 13:47:51 +02:00
parent 6ef2e658e8
commit 712133ea44

View file

@ -7,6 +7,7 @@ import (
"github.com/evcc-io/evcc/util/templates"
"github.com/gorilla/mux"
"github.com/samber/lo"
)
var supportedLanguages = []string{"en", "de"}
@ -34,8 +35,8 @@ func templatesHandler(w http.ResponseWriter, r *http.Request) {
// filter deprecated properties
filterParams := func(t templates.Template) templates.Template {
t.Params = slices.DeleteFunc(t.Params, func(p templates.Param) bool {
return p.IsDeprecated()
t.Params = lo.Filter(t.Params, func(p templates.Param, _ int) bool {
return !p.IsDeprecated()
})
return t
}