Fixed: Fallback to Instance Name for Discord notifications

pull/7657/head
Stevie Robinson 2 months ago committed by GitHub
parent 5d16169e52
commit b99e06acc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -4,6 +4,7 @@ using System.Globalization;
using System.Linq;
using FluentValidation.Results;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Localization;
using NzbDrone.Core.MediaCover;
using NzbDrone.Core.MediaFiles;
@ -17,11 +18,13 @@ namespace NzbDrone.Core.Notifications.Discord
public class Discord : NotificationBase<DiscordSettings>
{
private readonly IDiscordProxy _proxy;
private readonly IConfigFileProvider _configFileProvider;
private readonly ILocalizationService _localizationService;
public Discord(IDiscordProxy proxy, ILocalizationService localizationService)
public Discord(IDiscordProxy proxy, IConfigFileProvider configFileProvider, ILocalizationService localizationService)
{
_proxy = proxy;
_configFileProvider = configFileProvider;
_localizationService = localizationService;
}
@ -37,7 +40,7 @@ namespace NzbDrone.Core.Notifications.Discord
{
Author = new DiscordAuthor
{
Name = Settings.Author.IsNullOrWhiteSpace() ? Environment.MachineName : Settings.Author,
Name = Settings.Author.IsNullOrWhiteSpace() ? _configFileProvider.InstanceName : Settings.Author,
IconUrl = "https://raw.githubusercontent.com/Sonarr/Sonarr/develop/Logo/256.png"
},
Url = $"http://thetvdb.com/?tab=series&id={series.TvdbId}",
@ -140,7 +143,7 @@ namespace NzbDrone.Core.Notifications.Discord
{
Author = new DiscordAuthor
{
Name = Settings.Author.IsNullOrWhiteSpace() ? Environment.MachineName : Settings.Author,
Name = Settings.Author.IsNullOrWhiteSpace() ? _configFileProvider.InstanceName : Settings.Author,
IconUrl = "https://raw.githubusercontent.com/Sonarr/Sonarr/develop/Logo/256.png"
},
Url = $"http://thetvdb.com/?tab=series&id={series.TvdbId}",
@ -254,7 +257,7 @@ namespace NzbDrone.Core.Notifications.Discord
{
Author = new DiscordAuthor
{
Name = Settings.Author.IsNullOrWhiteSpace() ? Environment.MachineName : Settings.Author,
Name = Settings.Author.IsNullOrWhiteSpace() ? _configFileProvider.InstanceName : Settings.Author,
IconUrl = "https://raw.githubusercontent.com/Sonarr/Sonarr/develop/Logo/256.png"
},
Url = $"http://thetvdb.com/?tab=series&id={series.TvdbId}",
@ -361,7 +364,7 @@ namespace NzbDrone.Core.Notifications.Discord
{
Author = new DiscordAuthor
{
Name = Settings.Author.IsNullOrWhiteSpace() ? Environment.MachineName : Settings.Author,
Name = Settings.Author.IsNullOrWhiteSpace() ? _configFileProvider.InstanceName : Settings.Author,
IconUrl = "https://raw.githubusercontent.com/Sonarr/Sonarr/develop/Logo/256.png"
},
Url = $"http://thetvdb.com/?tab=series&id={series.TvdbId}",
@ -388,7 +391,7 @@ namespace NzbDrone.Core.Notifications.Discord
{
Author = new DiscordAuthor
{
Name = Settings.Author.IsNullOrWhiteSpace() ? Environment.MachineName : Settings.Author,
Name = Settings.Author.IsNullOrWhiteSpace() ? _configFileProvider.InstanceName : Settings.Author,
IconUrl = "https://raw.githubusercontent.com/Sonarr/Sonarr/develop/Logo/256.png"
},
Url = $"http://thetvdb.com/?tab=series&id={series.TvdbId}",
@ -427,7 +430,7 @@ namespace NzbDrone.Core.Notifications.Discord
{
Author = new DiscordAuthor
{
Name = Settings.Author.IsNullOrWhiteSpace() ? Environment.MachineName : Settings.Author,
Name = Settings.Author.IsNullOrWhiteSpace() ? _configFileProvider.InstanceName : Settings.Author,
IconUrl = "https://raw.githubusercontent.com/Sonarr/Sonarr/develop/Logo/256.png"
},
Url = $"http://thetvdb.com/?tab=series&id={series.TvdbId}",
@ -464,7 +467,7 @@ namespace NzbDrone.Core.Notifications.Discord
{
Author = new DiscordAuthor
{
Name = Settings.Author.IsNullOrWhiteSpace() ? Environment.MachineName : Settings.Author,
Name = Settings.Author.IsNullOrWhiteSpace() ? _configFileProvider.InstanceName : Settings.Author,
IconUrl = "https://raw.githubusercontent.com/Sonarr/Sonarr/develop/Logo/256.png"
},
Title = healthCheck.Source.Name,
@ -484,7 +487,7 @@ namespace NzbDrone.Core.Notifications.Discord
{
Author = new DiscordAuthor
{
Name = Settings.Author.IsNullOrWhiteSpace() ? Environment.MachineName : Settings.Author,
Name = Settings.Author.IsNullOrWhiteSpace() ? _configFileProvider.InstanceName : Settings.Author,
IconUrl = "https://raw.githubusercontent.com/Sonarr/Sonarr/develop/Logo/256.png"
},
Title = "Health Issue Resolved: " + previousCheck.Source.Name,
@ -504,7 +507,7 @@ namespace NzbDrone.Core.Notifications.Discord
{
Author = new DiscordAuthor
{
Name = Settings.Author.IsNullOrWhiteSpace() ? Environment.MachineName : Settings.Author,
Name = Settings.Author.IsNullOrWhiteSpace() ? _configFileProvider.InstanceName : Settings.Author,
IconUrl = "https://raw.githubusercontent.com/Sonarr/Sonarr/develop/Logo/256.png"
},
Title = APPLICATION_UPDATE_TITLE,
@ -539,7 +542,7 @@ namespace NzbDrone.Core.Notifications.Discord
{
Author = new DiscordAuthor
{
Name = Settings.Author.IsNullOrWhiteSpace() ? Environment.MachineName : Settings.Author,
Name = Settings.Author.IsNullOrWhiteSpace() ? _configFileProvider.InstanceName : Settings.Author,
IconUrl = "https://raw.githubusercontent.com/Sonarr/Sonarr/develop/Logo/256.png"
},
Url = series?.TvdbId > 0 ? $"http://thetvdb.com/?tab=series&id={series.TvdbId}" : null,

Loading…
Cancel
Save