From 82c8bd33ed1172c03c9f46e32972afba88f9c610 Mon Sep 17 00:00:00 2001 From: Allan Guwatudde Date: Wed, 30 Mar 2022 11:31:46 +0300 Subject: [PATCH] [MM-42703] - Add configuration setting to disable Inactive Server email notification (#19831) * [MM-42703] - Add configuration setting to disable Inactive Server email notification * remove log * add config to telemetry * fix lint --- app/server_inactivity.go | 5 +++++ model/config.go | 5 +++++ services/telemetry/telemetry.go | 1 + tests/test-config.json | 3 ++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/server_inactivity.go b/app/server_inactivity.go index 177cf3e8e3..0d91844737 100644 --- a/app/server_inactivity.go +++ b/app/server_inactivity.go @@ -17,6 +17,11 @@ import ( const serverInactivityHours = 100 func (s *Server) doInactivityCheck() { + if !*s.Config().EmailSettings.EnableInactivityEmail { + mlog.Info("No activity check because EnableInactivityEmail is false") + return + } + if !s.Config().FeatureFlags.EnableInactivityCheckJob { mlog.Info("No activity check because EnableInactivityCheckJob feature flag is disabled") return diff --git a/model/config.go b/model/config.go index 7a37d6b24d..32e7f07d60 100644 --- a/model/config.go +++ b/model/config.go @@ -1541,6 +1541,7 @@ type EmailSettings struct { LoginButtonColor *string `access:"experimental_features"` LoginButtonBorderColor *string `access:"experimental_features"` LoginButtonTextColor *string `access:"experimental_features"` + EnableInactivityEmail *bool } func (s *EmailSettings) SetDefaults(isUpdate bool) { @@ -1683,6 +1684,10 @@ func (s *EmailSettings) SetDefaults(isUpdate bool) { if s.LoginButtonTextColor == nil { s.LoginButtonTextColor = NewString("#2389D7") } + + if s.EnableInactivityEmail == nil { + s.EnableInactivityEmail = NewBool(true) + } } type RateLimitSettings struct { diff --git a/services/telemetry/telemetry.go b/services/telemetry/telemetry.go index d2090d4c54..2138053dc8 100644 --- a/services/telemetry/telemetry.go +++ b/services/telemetry/telemetry.go @@ -567,6 +567,7 @@ func (ts *TelemetryService) trackConfig() { "isdefault_login_button_border_color": isDefault(*cfg.EmailSettings.LoginButtonBorderColor, ""), "isdefault_login_button_text_color": isDefault(*cfg.EmailSettings.LoginButtonTextColor, ""), "smtp_server_timeout": *cfg.EmailSettings.SMTPServerTimeout, + "enable_inactivity_email": *cfg.EmailSettings.EnableInactivityEmail, }) ts.SendTelemetry(TrackConfigRate, map[string]interface{}{ diff --git a/tests/test-config.json b/tests/test-config.json index f7320602db..e0a27a2c59 100644 --- a/tests/test-config.json +++ b/tests/test-config.json @@ -164,7 +164,8 @@ "EmailNotificationContentsType": "full", "LoginButtonColor": "", "LoginButtonBorderColor": "", - "LoginButtonTextColor": "" + "LoginButtonTextColor": "", + "EnableInactivityEmail": true }, "RateLimitSettings": { "Enable": false,