From c5562b0d28c05b1e9499ff24bebdfd8037b2f82c Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 27 Oct 2023 15:23:06 +0200 Subject: dashboard: forward incoming commands emails Instead of reminding users to mention our mailing lists, forward their emails there automatically. Closes #4260. --- dashboard/app/util_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'dashboard/app/util_test.go') diff --git a/dashboard/app/util_test.go b/dashboard/app/util_test.go index 171ec8029..ba4a953d3 100644 --- a/dashboard/app/util_test.go +++ b/dashboard/app/util_test.go @@ -246,6 +246,12 @@ func (c *Ctx) setNoObsoletions() { } } +func (c *Ctx) updateReporting(ns, name string, f func(Reporting) Reporting) { + c.transformContext = func(c context.Context) context.Context { + return contextWithConfig(c, replaceReporting(c, ns, name, f)) + } +} + func (c *Ctx) decommissionManager(ns, oldManager, newManager string) { c.transformContext = func(c context.Context) context.Context { newConfig := replaceManagerConfig(c, ns, oldManager, func(cfg ConfigManager) ConfigManager { @@ -729,3 +735,18 @@ func replaceManagerConfig(c context.Context, ns, mgr string, f func(ConfigManage return &ret }) } + +func replaceReporting(c context.Context, ns, name string, f func(Reporting) Reporting) *GlobalConfig { + return replaceNamespaceConfig(c, ns, func(cfg *Config) *Config { + ret := *cfg + var newReporting []Reporting + for _, cfg := range ret.Reporting { + if cfg.Name == name { + cfg = f(cfg) + } + newReporting = append(newReporting, cfg) + } + ret.Reporting = newReporting + return &ret + }) +} -- cgit mrf-deployment