aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/app/util_test.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-10-27 15:23:06 +0200
committerAleksandr Nogikh <nogikh@google.com>2023-11-02 10:32:36 +0000
commitc5562b0d28c05b1e9499ff24bebdfd8037b2f82c (patch)
treed35170f05837be9c0ff31492f9a4ad67efd40bb9 /dashboard/app/util_test.go
parent69904c9f85fcfb289eb529599176d42bcb3609eb (diff)
dashboard: forward incoming commands emails
Instead of reminding users to mention our mailing lists, forward their emails there automatically. Closes #4260.
Diffstat (limited to 'dashboard/app/util_test.go')
-rw-r--r--dashboard/app/util_test.go21
1 files changed, 21 insertions, 0 deletions
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
+ })
+}