@ -106,7 +106,8 @@ namespace Ombi.Notifications.Agents
};
var fields = new List<DiscordField>();
if (!settings.HideUser)
{
if (model.Data.TryGetValue("Alias", out var alias))
if (alias.HasValue())
@ -124,6 +125,7 @@ namespace Ombi.Notifications.Agents
}
if (model.Data.TryGetValue("DenyReason", out var denyReason))
if (denyReason.HasValue())
@ -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())
@ -304,9 +304,9 @@ namespace Ombi.Notifications.Agents
private async Task AddSubscribedUsers(List<string> playerIds)
var notificationId = user.NotificationUserIds;
if (notificationId.Any())
@ -346,9 +346,9 @@ namespace Ombi.Notifications.Agents
var notificationIds = await _notifications.GetAll().Where(x => x.UserId == user.Id).ToListAsync();
@ -48,7 +48,7 @@ namespace Ombi.Notifications
protected ChildRequests TvRequest { get; set; }
protected AlbumRequest AlbumRequest { get; set; }
protected MovieRequests MovieRequest { get; set; }
protected IQueryable<OmbiUser> SubsribedUsers { get; private set; }
protected IQueryable<OmbiUser> 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();
@ -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);
@ -59,6 +59,7 @@ export interface IDiscordNotifcationSettings extends INotificationSettings {
webhookUrl: string;
username: string;
icon: string;
hideUser: boolean;
notificationTemplates: INotificationTemplates[];
@ -24,6 +24,8 @@
<mat-label>Username</mat-label>
<input matInput formControlName="username">
</mat-form-field>
<mat-slide-toggle matTooltip="This when enabled will not show the user who did the action e.g. Requested a new movie" formControlName="hideUser">Hide Users in notification</mat-slide-toggle>
</div>
<div class="md-form-field">
<mat-form-field appearance="outline">
@ -34,6 +36,7 @@
<img [src]="form.value.icon" style="width: 300px" />
<div class="row top-space">
@ -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]
});