mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-23 22:45:23 -07:00
Send new request email notifications to power users
This commit is contained in:
parent
1a17da325d
commit
8d35a3dd7b
5 changed files with 23 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MailKit.Net.Smtp;
|
using MailKit.Net.Smtp;
|
||||||
|
@ -114,8 +115,21 @@ namespace Ombi.Notifications.Agents
|
||||||
var plaintext = await LoadPlainTextMessage(NotificationType.NewRequest, model, settings);
|
var plaintext = await LoadPlainTextMessage(NotificationType.NewRequest, model, settings);
|
||||||
message.Other.Add("PlainTextBody", plaintext);
|
message.Other.Add("PlainTextBody", plaintext);
|
||||||
|
|
||||||
|
IEnumerable<OmbiUser> recipients = await _userManager.GetUsersInRoleAsync(OmbiRoles.Admin);
|
||||||
|
if (settings.SendNewRequestToPowerUsers)
|
||||||
|
{
|
||||||
|
recipients = recipients.Concat(await _userManager.GetUsersInRoleAsync(OmbiRoles.PowerUser));
|
||||||
|
}
|
||||||
|
foreach (var recipient in recipients.DistinctBy(x => x.Email))
|
||||||
|
{
|
||||||
|
if (recipient.Email.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
message.To = recipient.Email;
|
||||||
await Send(message, settings);
|
await Send(message, settings);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override async Task NewIssue(NotificationOptions model, EmailNotificationSettings settings)
|
protected override async Task NewIssue(NotificationOptions model, EmailNotificationSettings settings)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,5 +13,6 @@
|
||||||
public string AdminEmail { get; set; }
|
public string AdminEmail { get; set; }
|
||||||
public bool DisableTLS { get; set; }
|
public bool DisableTLS { get; set; }
|
||||||
public bool DisableCertificateChecking { get; set; }
|
public bool DisableCertificateChecking { get; set; }
|
||||||
|
public bool SendNewRequestToPowerUsers{ get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,6 +15,7 @@ export interface IEmailNotificationSettings extends INotificationSettings {
|
||||||
adminEmail: string;
|
adminEmail: string;
|
||||||
disableTLS: boolean;
|
disableTLS: boolean;
|
||||||
disableCertificateChecking: boolean;
|
disableCertificateChecking: boolean;
|
||||||
|
sendNewRequestToPowerUsers: boolean;
|
||||||
notificationTemplates: INotificationTemplates[];
|
notificationTemplates: INotificationTemplates[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,10 @@
|
||||||
<mat-slide-toggle formControlName="disableCertificateChecking">Disable Certificate
|
<mat-slide-toggle formControlName="disableCertificateChecking">Disable Certificate
|
||||||
Checking</mat-slide-toggle>
|
Checking</mat-slide-toggle>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="md-form-field">
|
||||||
|
<mat-slide-toggle formControlName="sendNewRequestToPowerUsers">Send New Request
|
||||||
|
To Power Users</mat-slide-toggle>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -61,7 +65,7 @@
|
||||||
<div class="md-form-field">
|
<div class="md-form-field">
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Admin Email</mat-label>
|
<mat-label>Admin Email</mat-label>
|
||||||
<input matInput formControlName="adminEmail" matTooltip="The administrator email will be used to send emails for admin only notifications (e.g. New Requests that require approvals)">
|
<input matInput formControlName="adminEmail" matTooltip="The administrator email will be used to send emails for admin only notifications (e.g. raised issues)">
|
||||||
<mat-error *ngIf="emailForm.get('adminEmail').hasError('required')">
|
<mat-error *ngIf="emailForm.get('adminEmail').hasError('required')">
|
||||||
Admin Email is <strong>required</strong>
|
Admin Email is <strong>required</strong>
|
||||||
</mat-error>
|
</mat-error>
|
||||||
|
|
|
@ -38,6 +38,7 @@ export class EmailNotificationComponent implements OnInit {
|
||||||
adminEmail: [x.adminEmail, [Validators.required, Validators.email]],
|
adminEmail: [x.adminEmail, [Validators.required, Validators.email]],
|
||||||
disableTLS: [x.disableTLS],
|
disableTLS: [x.disableTLS],
|
||||||
disableCertificateChecking: [x.disableCertificateChecking],
|
disableCertificateChecking: [x.disableCertificateChecking],
|
||||||
|
sendNewRequestToPowerUsers: [x.sendNewRequestToPowerUsers],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (x.authentication) {
|
if (x.authentication) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue