@ -71,6 +71,13 @@ namespace Ombi.Notifications.Agents
return message ;
return message ;
}
}
private async Task < string > LoadPlainTextMessage ( NotificationType type , NotificationOptions model , EmailNotificationSettings settings )
{
var parsed = await LoadTemplate ( NotificationAgent . Email , type , model ) ;
return parsed . Message ;
}
protected override async Task NewRequest ( NotificationOptions model , EmailNotificationSettings settings )
protected override async Task NewRequest ( NotificationOptions model , EmailNotificationSettings settings )
{
{
var message = await LoadTemplate ( NotificationType . NewRequest , model , settings ) ;
var message = await LoadTemplate ( NotificationType . NewRequest , model , settings ) ;
@ -79,6 +86,9 @@ namespace Ombi.Notifications.Agents
return ;
return ;
}
}
var plaintext = await LoadPlainTextMessage ( NotificationType . NewRequest , model , settings ) ;
message . Other . Add ( "PlainTextBody" , plaintext ) ;
await Send ( message , settings ) ;
await Send ( message , settings ) ;
}
}
@ -90,6 +100,9 @@ namespace Ombi.Notifications.Agents
return ;
return ;
}
}
var plaintext = await LoadPlainTextMessage ( NotificationType . Issue , model , settings ) ;
message . Other . Add ( "PlainTextBody" , plaintext ) ;
// Issues should be sent to admin
// Issues should be sent to admin
message . To = settings . AdminEmail ;
message . To = settings . AdminEmail ;
@ -126,6 +139,9 @@ namespace Ombi.Notifications.Agents
To = settings . AdminEmail ,
To = settings . AdminEmail ,
} ;
} ;
var plaintext = $"Hello! The user '{user}' has requested {title} but it could not be added. This has been added into the requests queue and will keep retrying" ;
message . Other . Add ( "PlainTextBody" , plaintext ) ;
await Send ( message , settings ) ;
await Send ( message , settings ) ;
}
}
@ -136,6 +152,10 @@ namespace Ombi.Notifications.Agents
{
{
return ;
return ;
}
}
var plaintext = await LoadPlainTextMessage ( NotificationType . RequestDeclined , model , settings ) ;
message . Other . Add ( "PlainTextBody" , plaintext ) ;
message . To = model . RequestType = = RequestType . Movie
message . To = model . RequestType = = RequestType . Movie
? MovieRequest . RequestedUser . Email
? MovieRequest . RequestedUser . Email
: TvRequest . RequestedUser . Email ;
: TvRequest . RequestedUser . Email ;
@ -149,6 +169,10 @@ namespace Ombi.Notifications.Agents
{
{
return ;
return ;
}
}
var plaintext = await LoadPlainTextMessage ( NotificationType . RequestApproved , model , settings ) ;
message . Other . Add ( "PlainTextBody" , plaintext ) ;
message . To = model . RequestType = = RequestType . Movie
message . To = model . RequestType = = RequestType . Movie
? MovieRequest . RequestedUser . Email
? MovieRequest . RequestedUser . Email
: TvRequest . RequestedUser . Email ;
: TvRequest . RequestedUser . Email ;
@ -162,6 +186,10 @@ namespace Ombi.Notifications.Agents
{
{
return ;
return ;
}
}
var plaintext = await LoadPlainTextMessage ( NotificationType . RequestAvailable , model , settings ) ;
message . Other . Add ( "PlainTextBody" , plaintext ) ;
message . To = model . RequestType = = RequestType . Movie
message . To = model . RequestType = = RequestType . Movie
? MovieRequest . RequestedUser . Email
? MovieRequest . RequestedUser . Email
: TvRequest . RequestedUser . Email ;
: TvRequest . RequestedUser . Email ;