From 11c8bf6228662d62e2af7128a03a69dacae86c1a Mon Sep 17 00:00:00 2001 From: Dmitry Verkhoturov Date: Sun, 19 Dec 2021 10:44:29 +0100 Subject: [PATCH] do not issue deprecation warning on notify.type by default Default configuration for notify.type is "none", and prior to this change it was issuing the deprecation warning which was not an intended behaviour. --- backend/app/cmd/server.go | 4 +++- backend/app/cmd/server_test.go | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/app/cmd/server.go b/backend/app/cmd/server.go index 1a51c2a9..396b4818 100644 --- a/backend/app/cmd/server.go +++ b/backend/app/cmd/server.go @@ -354,7 +354,9 @@ func (s *ServerCommand) HandleDeprecatedFlags() (result []DeprecatedFlag) { s.ImageProxy.HTTP2HTTPS = s.LegacyImageProxy result = append(result, DeprecatedFlag{Old: "img-proxy", New: "image-proxy.http2https", Version: "1.5"}) } - if len(s.Notify.Type) != 0 && (len(s.Notify.Users) != 0 || len(s.Notify.Admins) != 0) { + if len(s.Notify.Type) != 0 && // explicitly empty, would likely never happen due to "none" default + !(len(s.Notify.Type) == 1 && contains("none", s.Notify.Type)) && // ignore default, "none" notify type + (len(s.Notify.Users) != 0 || len(s.Notify.Admins) != 0) { // new notify param(s) are used, safe to ignore the old one s.handleDeprecatedNotifications() result = append(result, DeprecatedFlag{Old: "notify.type", New: "notify.(users|admins)", Version: "1.9"}) } diff --git a/backend/app/cmd/server_test.go b/backend/app/cmd/server_test.go index 542e1b4c..074dce1b 100644 --- a/backend/app/cmd/server_test.go +++ b/backend/app/cmd/server_test.go @@ -410,6 +410,7 @@ func TestServerApp_DeprecatedArgs(t *testing.T) { p := flags.NewParser(&s, flags.Default) args := []string{ "test", + "--notify.type=telegram", "--auth.email.host=smtp.example.org", "--auth.email.port=666", "--auth.email.tls",