Better wording + fix mobile notifications

This commit is contained in:
Florian Dupret 2022-01-14 12:53:06 +01:00
commit 58b398d006
4 changed files with 12 additions and 12 deletions

View file

@ -115,7 +115,7 @@ 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);
foreach (var recipient in (await GetPowerUsers()).DistinctBy(x => x.Email)) foreach (var recipient in (await GetPrivilegedUsers()).DistinctBy(x => x.Email))
{ {
if (recipient.Email.IsNullOrEmpty()) if (recipient.Email.IsNullOrEmpty())
{ {

View file

@ -59,7 +59,7 @@ namespace Ombi.Notifications.Agents
}; };
// Get admin devices // Get admin devices
var playerIds = await GetAdmins(); var playerIds = await GetPrivilegedUsersPlayerIds();
await Send(playerIds, notification, settings, model, true); await Send(playerIds, notification, settings, model, true);
} }
@ -243,14 +243,14 @@ namespace Ombi.Notifications.Agents
private async Task<List<string>> GetAdmins() private async Task<List<string>> GetAdmins()
{ {
return await UsersToPlayerIds(await _userManager.GetUsersInRoleAsync(OmbiRoles.Admin)); return await GetNotificationRecipients(await _userManager.GetUsersInRoleAsync(OmbiRoles.Admin));
} }
private async Task<List<string>> GetPowerUsersPlayerIds() private async Task<List<string>> GetPrivilegedUsersPlayerIds()
{ {
return await UsersToPlayerIds(await GetPowerUsers()); return await GetNotificationRecipients(await GetPrivilegedUsers());
} }
private async Task<List<string>> UsersToPlayerIds(IEnumerable<OmbiUser> users) private async Task<List<string>> GetNotificationRecipients(IEnumerable<OmbiUser> users)
{ {
var adminUsers = users.Select(x => x.Id).ToList(); var adminUsers = users.Select(x => x.Id).ToList();

View file

@ -62,7 +62,7 @@ namespace Ombi.Notifications.Agents
}; };
// Get admin devices // Get admin devices
var playerIds = await GetAdmins(); var playerIds = await GetPrivilegedUsersPlayerIds();
await Send(playerIds, notification, settings, model, true); await Send(playerIds, notification, settings, model, true);
} }
@ -281,14 +281,14 @@ namespace Ombi.Notifications.Agents
private async Task<List<string>> GetAdmins() private async Task<List<string>> GetAdmins()
{ {
return await UsersToPlayerIds(await _userManager.GetUsersInRoleAsync(OmbiRoles.Admin)); return await GetNotificationRecipients(await _userManager.GetUsersInRoleAsync(OmbiRoles.Admin));
} }
private async Task<List<string>> GetPowerUsersPlayerIds() private async Task<List<string>> GetPrivilegedUsersPlayerIds()
{ {
return await UsersToPlayerIds(await GetPowerUsers()); return await GetNotificationRecipients(await GetPrivilegedUsers());
} }
private async Task<List<string>> UsersToPlayerIds(IEnumerable<OmbiUser> users) private async Task<List<string>> GetNotificationRecipients(IEnumerable<OmbiUser> users)
{ {
var adminUsers = users.Select(x => x.Id).ToList(); var adminUsers = users.Select(x => x.Id).ToList();

View file

@ -214,7 +214,7 @@ namespace Ombi.Notifications
.FirstOrDefault(x => x.Agent == agent && x.UserId == userId); .FirstOrDefault(x => x.Agent == agent && x.UserId == userId);
} }
protected async Task<IEnumerable<OmbiUser>> GetPowerUsers() protected async Task<IEnumerable<OmbiUser>> GetPrivilegedUsers()
{ {
IEnumerable<OmbiUser> recipients = await _userManager.GetUsersInRoleAsync(OmbiRoles.Admin); IEnumerable<OmbiUser> recipients = await _userManager.GetUsersInRoleAsync(OmbiRoles.Admin);
recipients = recipients.Concat(await _userManager.GetUsersInRoleAsync(OmbiRoles.PowerUser)); recipients = recipients.Concat(await _userManager.GetUsersInRoleAsync(OmbiRoles.PowerUser));