mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
Added the ability to hide the user in the discord notification
This commit is contained in:
parent
8aec700f11
commit
f18aa778e6
9 changed files with 29 additions and 21 deletions
|
@ -106,7 +106,8 @@ namespace Ombi.Notifications.Agents
|
||||||
};
|
};
|
||||||
|
|
||||||
var fields = new List<DiscordField>();
|
var fields = new List<DiscordField>();
|
||||||
|
if (!settings.HideUser)
|
||||||
|
{
|
||||||
if (model.Data.TryGetValue("Alias", out var alias))
|
if (model.Data.TryGetValue("Alias", out var alias))
|
||||||
{
|
{
|
||||||
if (alias.HasValue())
|
if (alias.HasValue())
|
||||||
|
@ -124,6 +125,7 @@ namespace Ombi.Notifications.Agents
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (model.Data.TryGetValue("DenyReason", out var denyReason))
|
if (model.Data.TryGetValue("DenyReason", out var denyReason))
|
||||||
{
|
{
|
||||||
if (denyReason.HasValue())
|
if (denyReason.HasValue())
|
||||||
|
|
|
@ -240,9 +240,9 @@ namespace Ombi.Notifications.Agents
|
||||||
|
|
||||||
private async Task SendToSubscribers(EmailNotificationSettings settings, NotificationMessage message)
|
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())
|
if (user.Email.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -304,9 +304,9 @@ namespace Ombi.Notifications.Agents
|
||||||
|
|
||||||
private async Task AddSubscribedUsers(List<string> playerIds)
|
private async Task AddSubscribedUsers(List<string> playerIds)
|
||||||
{
|
{
|
||||||
if (await SubsribedUsers.AnyAsync())
|
if (await Subscribed.AnyAsync())
|
||||||
{
|
{
|
||||||
foreach (var user in SubsribedUsers)
|
foreach (var user in Subscribed)
|
||||||
{
|
{
|
||||||
var notificationId = user.NotificationUserIds;
|
var notificationId = user.NotificationUserIds;
|
||||||
if (notificationId.Any())
|
if (notificationId.Any())
|
||||||
|
|
|
@ -346,9 +346,9 @@ namespace Ombi.Notifications.Agents
|
||||||
|
|
||||||
private async Task AddSubscribedUsers(List<string> playerIds)
|
private async Task AddSubscribedUsers(List<string> 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();
|
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 ChildRequests TvRequest { get; set; }
|
||||||
protected AlbumRequest AlbumRequest { get; set; }
|
protected AlbumRequest AlbumRequest { get; set; }
|
||||||
protected MovieRequests MovieRequest { 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; }
|
public abstract string NotificationName { get; }
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ namespace Ombi.Notifications
|
||||||
if (model.RequestId > 0)
|
if (model.RequestId > 0)
|
||||||
{
|
{
|
||||||
await LoadRequest(model.RequestId, model.RequestType);
|
await LoadRequest(model.RequestId, model.RequestType);
|
||||||
SubsribedUsers = GetSubscriptions(model.RequestId, model.RequestType);
|
Subscribed = GetSubscriptions(model.RequestId, model.RequestType);
|
||||||
}
|
}
|
||||||
|
|
||||||
Customization = await CustomizationSettings.GetSettingsAsync();
|
Customization = await CustomizationSettings.GetSettingsAsync();
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace Ombi.Settings.Settings.Models.Notifications
|
||||||
public string WebhookUrl { get; set; }
|
public string WebhookUrl { get; set; }
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
public string Icon { get; set; }
|
public string Icon { get; set; }
|
||||||
|
public bool HideUser { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string WebHookId => SplitWebUrl(4);
|
public string WebHookId => SplitWebUrl(4);
|
||||||
|
|
|
@ -59,6 +59,7 @@ export interface IDiscordNotifcationSettings extends INotificationSettings {
|
||||||
webhookUrl: string;
|
webhookUrl: string;
|
||||||
username: string;
|
username: string;
|
||||||
icon: string;
|
icon: string;
|
||||||
|
hideUser: boolean;
|
||||||
notificationTemplates: INotificationTemplates[];
|
notificationTemplates: INotificationTemplates[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
<mat-label>Username</mat-label>
|
<mat-label>Username</mat-label>
|
||||||
<input matInput formControlName="username">
|
<input matInput formControlName="username">
|
||||||
</mat-form-field>
|
</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>
|
||||||
<div class="md-form-field">
|
<div class="md-form-field">
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
|
@ -34,6 +36,7 @@
|
||||||
<img [src]="form.value.icon" style="width: 300px" />
|
<img [src]="form.value.icon" style="width: 300px" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row top-space">
|
<div class="row top-space">
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,8 @@ export class DiscordComponent implements OnInit {
|
||||||
enabled: [x.enabled],
|
enabled: [x.enabled],
|
||||||
username: [x.username],
|
username: [x.username],
|
||||||
webhookUrl: [x.webhookUrl, [Validators.required]],
|
webhookUrl: [x.webhookUrl, [Validators.required]],
|
||||||
icon: [x.icon]
|
icon: [x.icon],
|
||||||
|
hideUser: [x.hideUser]
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue