diff --git a/src/Ombi.Notifications/Agents/DiscordNotification.cs b/src/Ombi.Notifications/Agents/DiscordNotification.cs index dda10f210..4a0c369fc 100644 --- a/src/Ombi.Notifications/Agents/DiscordNotification.cs +++ b/src/Ombi.Notifications/Agents/DiscordNotification.cs @@ -106,21 +106,23 @@ namespace Ombi.Notifications.Agents }; var fields = new List(); - - if (model.Data.TryGetValue("Alias", out var alias)) + if (!settings.HideUser) { - if (alias.HasValue()) + if (model.Data.TryGetValue("Alias", out var alias)) { - fields.Add(new DiscordField { name = "Requested By", value = alias, inline = true }); + if (alias.HasValue()) + { + fields.Add(new DiscordField { name = "Requested By", value = alias, inline = true }); + } } - } - else - { - if (model.Data.TryGetValue("RequestedUser", out var requestedUser)) + else { - if (requestedUser.HasValue()) + if (model.Data.TryGetValue("RequestedUser", out var requestedUser)) { - fields.Add(new DiscordField { name = "Requested By", value = requestedUser, inline = true }); + if (requestedUser.HasValue()) + { + fields.Add(new DiscordField { name = "Requested By", value = requestedUser, inline = true }); + } } } } diff --git a/src/Ombi.Notifications/Agents/EmailNotification.cs b/src/Ombi.Notifications/Agents/EmailNotification.cs index a7f9334fb..b6d03305b 100644 --- a/src/Ombi.Notifications/Agents/EmailNotification.cs +++ b/src/Ombi.Notifications/Agents/EmailNotification.cs @@ -240,9 +240,9 @@ namespace Ombi.Notifications.Agents private async Task SendToSubscribers(EmailNotificationSettings settings, NotificationMessage message) { - if (await SubsribedUsers.AnyAsync()) + if (await Subscribed.AnyAsync()) { - foreach (var user in SubsribedUsers) + foreach (var user in Subscribed) { if (user.Email.IsNullOrEmpty()) { diff --git a/src/Ombi.Notifications/Agents/LegacyMobileNotification.cs b/src/Ombi.Notifications/Agents/LegacyMobileNotification.cs index 5ac92d5bf..33cec783c 100644 --- a/src/Ombi.Notifications/Agents/LegacyMobileNotification.cs +++ b/src/Ombi.Notifications/Agents/LegacyMobileNotification.cs @@ -304,9 +304,9 @@ namespace Ombi.Notifications.Agents private async Task AddSubscribedUsers(List playerIds) { - if (await SubsribedUsers.AnyAsync()) + if (await Subscribed.AnyAsync()) { - foreach (var user in SubsribedUsers) + foreach (var user in Subscribed) { var notificationId = user.NotificationUserIds; if (notificationId.Any()) diff --git a/src/Ombi.Notifications/Agents/MobileNotification.cs b/src/Ombi.Notifications/Agents/MobileNotification.cs index 864453b71..bb6454bfc 100644 --- a/src/Ombi.Notifications/Agents/MobileNotification.cs +++ b/src/Ombi.Notifications/Agents/MobileNotification.cs @@ -346,9 +346,9 @@ namespace Ombi.Notifications.Agents private async Task AddSubscribedUsers(List playerIds) { - if (await SubsribedUsers.AnyAsync()) + if (await Subscribed.AnyAsync()) { - foreach (var user in SubsribedUsers) + foreach (var user in Subscribed) { var notificationIds = await _notifications.GetAll().Where(x => x.UserId == user.Id).ToListAsync(); diff --git a/src/Ombi.Notifications/BaseNotification.cs b/src/Ombi.Notifications/BaseNotification.cs index 9d8bbb776..46db5d467 100644 --- a/src/Ombi.Notifications/BaseNotification.cs +++ b/src/Ombi.Notifications/BaseNotification.cs @@ -48,7 +48,7 @@ namespace Ombi.Notifications protected ChildRequests TvRequest { get; set; } protected AlbumRequest AlbumRequest { get; set; } protected MovieRequests MovieRequest { get; set; } - protected IQueryable SubsribedUsers { get; private set; } + protected IQueryable Subscribed { get; private set; } public abstract string NotificationName { get; } @@ -75,7 +75,7 @@ namespace Ombi.Notifications if (model.RequestId > 0) { await LoadRequest(model.RequestId, model.RequestType); - SubsribedUsers = GetSubscriptions(model.RequestId, model.RequestType); + Subscribed = GetSubscriptions(model.RequestId, model.RequestType); } Customization = await CustomizationSettings.GetSettingsAsync(); diff --git a/src/Ombi.Settings/Settings/Models/Notifications/DiscordNotificationSettings.cs b/src/Ombi.Settings/Settings/Models/Notifications/DiscordNotificationSettings.cs index 45dc17ee1..0ec81a6d8 100644 --- a/src/Ombi.Settings/Settings/Models/Notifications/DiscordNotificationSettings.cs +++ b/src/Ombi.Settings/Settings/Models/Notifications/DiscordNotificationSettings.cs @@ -9,6 +9,7 @@ namespace Ombi.Settings.Settings.Models.Notifications public string WebhookUrl { get; set; } public string Username { get; set; } public string Icon { get; set; } + public bool HideUser { get; set; } [JsonIgnore] public string WebHookId => SplitWebUrl(4); diff --git a/src/Ombi/ClientApp/src/app/interfaces/INotificationSettings.ts b/src/Ombi/ClientApp/src/app/interfaces/INotificationSettings.ts index d08778e2a..e1c52103c 100644 --- a/src/Ombi/ClientApp/src/app/interfaces/INotificationSettings.ts +++ b/src/Ombi/ClientApp/src/app/interfaces/INotificationSettings.ts @@ -59,6 +59,7 @@ export interface IDiscordNotifcationSettings extends INotificationSettings { webhookUrl: string; username: string; icon: string; + hideUser: boolean; notificationTemplates: INotificationTemplates[]; } diff --git a/src/Ombi/ClientApp/src/app/settings/notifications/discord.component.html b/src/Ombi/ClientApp/src/app/settings/notifications/discord.component.html index 140198c94..9f19ae9a2 100644 --- a/src/Ombi/ClientApp/src/app/settings/notifications/discord.component.html +++ b/src/Ombi/ClientApp/src/app/settings/notifications/discord.component.html @@ -24,6 +24,8 @@ Username + Hide Users in notification +
@@ -34,6 +36,7 @@
+
diff --git a/src/Ombi/ClientApp/src/app/settings/notifications/discord.component.ts b/src/Ombi/ClientApp/src/app/settings/notifications/discord.component.ts index 73f271894..e2e92e55c 100644 --- a/src/Ombi/ClientApp/src/app/settings/notifications/discord.component.ts +++ b/src/Ombi/ClientApp/src/app/settings/notifications/discord.component.ts @@ -29,7 +29,8 @@ export class DiscordComponent implements OnInit { enabled: [x.enabled], username: [x.username], webhookUrl: [x.webhookUrl, [Validators.required]], - icon: [x.icon] + icon: [x.icon], + hideUser: [x.hideUser] }); });