From e1a2374a2d996a0a7f90414fa358751b1572e7bd Mon Sep 17 00:00:00 2001 From: Dmitry Verkhoturov Date: Thu, 4 Nov 2021 21:36:40 +0100 Subject: [PATCH] clarify telegram notification flow --- backend/app/cmd/server.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/backend/app/cmd/server.go b/backend/app/cmd/server.go index 0e8e6527..db6cb31f 100644 --- a/backend/app/cmd/server.go +++ b/backend/app/cmd/server.go @@ -472,28 +472,27 @@ func (s *ServerCommand) newServerApp(ctx context.Context) (*serverApp, error) { KeyStore: adminStore, } - var telegramService *notify.Telegram - var telegramBotUsername string notifyDestinations, err := s.makeNotifyDestinations(authenticator) if err != nil { log.Printf("[WARN] failed to prepare notify destinations, %s", err) } + var telegramService *notify.Telegram if contains("telegram", s.Notify.Users) || contains("telegram", s.Notify.Admins) { telegramService, err = s.makeTelegramNotify() if err != nil { log.Printf("[WARN] failed to make telegram notify service, %s", err) - } else { - notifyDestinations = append(notifyDestinations, telegramService) } } - notifyService := s.makeNotifyService(dataService, notifyDestinations) - + var telegramBotUsername string if telegramService != nil { + notifyDestinations = append(notifyDestinations, telegramService) telegramBotUsername = telegramService.GetBotUsername() } + notifyService := s.makeNotifyService(dataService, notifyDestinations) + imgProxy := &proxy.Image{ HTTP2HTTPS: s.ImageProxy.HTTP2HTTPS, CacheExternal: s.ImageProxy.CacheExternal, @@ -813,8 +812,8 @@ func (s *ServerCommand) addAuthProviders(ctx context.Context, authenticator *aut if s.Auth.Telegram { telegram := &provider.TelegramHandler{ ProviderName: "telegram", - ErrorMsg: "❌ Invalid auth request. Please try clicking link again.", - SuccessMsg: "✅ You have successfully authenticated!", + ErrorMsg: "❌ Invalid auth request. Please try requesting the link again.", + SuccessMsg: "✅ You have successfully authenticated, check the web!", Telegram: provider.NewTelegramAPI(s.Telegram.Token, &http.Client{Timeout: s.Telegram.Timeout}), L: log.Default(), TokenService: authenticator.TokenService(),