diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index 3a88c6e8d..f8ef93533 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -495,6 +495,8 @@ "Notifications": "Notifications", "NotificationsEmailSettingsUseEncryption": "Use Encryption", "NotificationsEmailSettingsUseEncryptionHelpText": "Whether to prefer using encryption if configured on the server, to always use encryption via SSL (Port 465 only) or StartTLS (any other port) or to never use encryption", + "NotificationsTelegramSettingsIncludeAppName": "Include {appName} in Title", + "NotificationsTelegramSettingsIncludeAppNameHelpText": "Optionally prefix message title with {appName} to differentiate notifications from different applications", "OAuthPopupMessage": "Pop-ups are being blocked by your browser", "Ok": "Ok", "OnApplicationUpdate": "On Application Update", diff --git a/src/NzbDrone.Core/Notifications/Telegram/Telegram.cs b/src/NzbDrone.Core/Notifications/Telegram/Telegram.cs index 6cf9b97e0..916aa6312 100644 --- a/src/NzbDrone.Core/Notifications/Telegram/Telegram.cs +++ b/src/NzbDrone.Core/Notifications/Telegram/Telegram.cs @@ -18,22 +18,30 @@ namespace NzbDrone.Core.Notifications.Telegram public override void OnGrab(GrabMessage message) { - _proxy.SendNotification(RELEASE_GRABBED_TITLE, message.Message, Settings); + var title = Settings.IncludeAppNameInTitle ? RELEASE_GRABBED_TITLE_BRANDED : RELEASE_GRABBED_TITLE; + + _proxy.SendNotification(title, message.Message, Settings); } public override void OnHealthIssue(HealthCheck.HealthCheck healthCheck) { - _proxy.SendNotification(HEALTH_ISSUE_TITLE, healthCheck.Message, Settings); + var title = Settings.IncludeAppNameInTitle ? HEALTH_ISSUE_TITLE_BRANDED : HEALTH_ISSUE_TITLE; + + _proxy.SendNotification(title, healthCheck.Message, Settings); } public override void OnHealthRestored(HealthCheck.HealthCheck previousCheck) { - _proxy.SendNotification(HEALTH_RESTORED_TITLE, $"The following issue is now resolved: {previousCheck.Message}", Settings); + var title = Settings.IncludeAppNameInTitle ? HEALTH_RESTORED_TITLE_BRANDED : HEALTH_RESTORED_TITLE; + + _proxy.SendNotification(title, $"The following issue is now resolved: {previousCheck.Message}", Settings); } public override void OnApplicationUpdate(ApplicationUpdateMessage updateMessage) { - _proxy.SendNotification(APPLICATION_UPDATE_TITLE, updateMessage.Message, Settings); + var title = Settings.IncludeAppNameInTitle ? APPLICATION_UPDATE_TITLE_BRANDED : APPLICATION_UPDATE_TITLE; + + _proxy.SendNotification(title, updateMessage.Message, Settings); } public override ValidationResult Test() diff --git a/src/NzbDrone.Core/Notifications/Telegram/TelegramService.cs b/src/NzbDrone.Core/Notifications/Telegram/TelegramService.cs index ec17ad4aa..ca235da3b 100644 --- a/src/NzbDrone.Core/Notifications/Telegram/TelegramService.cs +++ b/src/NzbDrone.Core/Notifications/Telegram/TelegramService.cs @@ -49,10 +49,11 @@ namespace NzbDrone.Core.Notifications.Telegram { try { + const string brandedTitle = "Prowlarr - Test Notification"; const string title = "Test Notification"; const string body = "This is a test message from Prowlarr"; - SendNotification(title, body, settings); + SendNotification(settings.IncludeAppNameInTitle ? brandedTitle : title, body, settings); } catch (Exception ex) { diff --git a/src/NzbDrone.Core/Notifications/Telegram/TelegramSettings.cs b/src/NzbDrone.Core/Notifications/Telegram/TelegramSettings.cs index 774fd4ca0..4ff40ae93 100644 --- a/src/NzbDrone.Core/Notifications/Telegram/TelegramSettings.cs +++ b/src/NzbDrone.Core/Notifications/Telegram/TelegramSettings.cs @@ -32,6 +32,9 @@ namespace NzbDrone.Core.Notifications.Telegram [FieldDefinition(3, Label = "Send Silently", Type = FieldType.Checkbox, HelpText = "Sends the message silently. Users will receive a notification with no sound")] public bool SendSilently { get; set; } + [FieldDefinition(4, Label = "NotificationsTelegramSettingsIncludeAppName", Type = FieldType.Checkbox, HelpText = "NotificationsTelegramSettingsIncludeAppNameHelpText")] + public bool IncludeAppNameInTitle { get; set; } + public NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate(this));