mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 15:56:05 -07:00
better way of obtaining clean enum string
This commit is contained in:
parent
6bf773591e
commit
818c2e80f7
4 changed files with 6 additions and 6 deletions
|
@ -120,8 +120,8 @@ namespace PlexRequests.Services.Notification
|
||||||
{
|
{
|
||||||
var message = new MimeMessage
|
var message = new MimeMessage
|
||||||
{
|
{
|
||||||
Body = new TextPart("plain") { Text = $"Hello! The user '{model.User}' has requested the {RequestTypeDisplay.Get(model.RequestType)?.ToLower()} '{model.Title}'! Please log in to approve this request. Request Date: {model.DateTime.ToString("f")}" },
|
Body = new TextPart("plain") { Text = $"Hello! The user '{model.User}' has requested the {model.RequestType.GetString()?.ToLower()} '{model.Title}'! Please log in to approve this request. Request Date: {model.DateTime.ToString("f")}" },
|
||||||
Subject = $"Plex Requests: New {RequestTypeDisplay.Get(model.RequestType)?.ToLower()} request for {model.Title}!"
|
Subject = $"Plex Requests: New {model.RequestType.GetString()?.ToLower()} request for {model.Title}!"
|
||||||
};
|
};
|
||||||
message.From.Add(new MailboxAddress(settings.EmailSender, settings.EmailSender));
|
message.From.Add(new MailboxAddress(settings.EmailSender, settings.EmailSender));
|
||||||
message.To.Add(new MailboxAddress(settings.RecipientEmail, settings.RecipientEmail));
|
message.To.Add(new MailboxAddress(settings.RecipientEmail, settings.RecipientEmail));
|
||||||
|
|
|
@ -105,8 +105,8 @@ namespace PlexRequests.Services.Notification
|
||||||
|
|
||||||
private async Task PushNewRequestAsync(NotificationModel model, PushbulletNotificationSettings settings)
|
private async Task PushNewRequestAsync(NotificationModel model, PushbulletNotificationSettings settings)
|
||||||
{
|
{
|
||||||
var message = $"The {RequestTypeDisplay.Get(model.RequestType)?.ToLower()} '{model.Title}' has been requested by user: {model.User}";
|
var message = $"The {model.RequestType.GetString()?.ToLower()} '{model.Title}' has been requested by user: {model.User}";
|
||||||
var pushTitle = $"Plex Requests: The {RequestTypeDisplay.Get(model.RequestType)?.ToLower()} {model.Title} has been requested!";
|
var pushTitle = $"Plex Requests: The {model.RequestType.GetString()?.ToLower()} {model.Title} has been requested!";
|
||||||
await Push(settings, message, pushTitle);
|
await Push(settings, message, pushTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ namespace PlexRequests.Services.Notification
|
||||||
|
|
||||||
private async Task PushNewRequestAsync(NotificationModel model, PushoverNotificationSettings settings)
|
private async Task PushNewRequestAsync(NotificationModel model, PushoverNotificationSettings settings)
|
||||||
{
|
{
|
||||||
var message = $"Plex Requests: The {RequestTypeDisplay.Get(model.RequestType)?.ToLower()} '{model.Title}' has been requested by user: {model.User}";
|
var message = $"Plex Requests: The {model.RequestType.GetString()?.ToLower()} '{model.Title}' has been requested by user: {model.User}";
|
||||||
await Push(settings, message);
|
await Push(settings, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace PlexRequests.Store
|
||||||
|
|
||||||
public static class RequestTypeDisplay
|
public static class RequestTypeDisplay
|
||||||
{
|
{
|
||||||
public static string Get(RequestType type)
|
public static string GetString(this RequestType type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue