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.
This commit is contained in:
Dmitry Verkhoturov
2021-12-19 23:32:48 -06:00
committed by Umputun
parent f43dfd57e0
commit 11c8bf6228
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -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"})
}
+1
View File
@@ -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",