mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 00:32:57 -07:00
Fixed #891
This commit is contained in:
parent
d6fa9f8af7
commit
bda34c9d1b
3 changed files with 12 additions and 9 deletions
|
@ -95,7 +95,7 @@ namespace Ombi.Services.Notification
|
||||||
if (user.Equals(adminUsername, StringComparison.CurrentCultureIgnoreCase))
|
if (user.Equals(adminUsername, StringComparison.CurrentCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
Log.Info("This user is the Plex server owner");
|
Log.Info("This user is the Plex server owner");
|
||||||
await PublishUserNotification(userAccount.Username, userAccount.Email, model.Title, model.PosterPath, type);
|
await PublishUserNotification(userAccount.Username, userAccount.Email, model.Title, model.PosterPath, type, model.Type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ namespace Ombi.Services.Notification
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Info("Sending notification to: {0} at: {1}, for title: {2}", email.Username, email.Email, model.Title);
|
Log.Info("Sending notification to: {0} at: {1}, for title: {2}", email.Username, email.Email, model.Title);
|
||||||
await PublishUserNotification(email.Username, email.Email, model.Title, model.PosterPath, type);
|
await PublishUserNotification(email.Username, email.Email, model.Title, model.PosterPath, type, model.Type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ namespace Ombi.Services.Notification
|
||||||
if (user.Equals(adminUsername, StringComparison.CurrentCultureIgnoreCase))
|
if (user.Equals(adminUsername, StringComparison.CurrentCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
Log.Info("This user is the Plex server owner");
|
Log.Info("This user is the Plex server owner");
|
||||||
await PublishUserNotification(userAccount.Username, userAccount.Email, model.Title, model.PosterPath, type);
|
await PublishUserNotification(userAccount.Username, userAccount.Email, model.Title, model.PosterPath, type, model.Type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ namespace Ombi.Services.Notification
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Info("Sending notification to: {0} at: {1}, for title: {2}", email.Username, email.Email, model.Title);
|
Log.Info("Sending notification to: {0} at: {1}, for title: {2}", email.Username, email.Email, model.Title);
|
||||||
await PublishUserNotification(email.Username, email.Email, model.Title, model.PosterPath, type);
|
await PublishUserNotification(email.Username, email.Email, model.Title, model.PosterPath, type, model.Type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -159,7 +159,7 @@ namespace Ombi.Services.Notification
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task PublishUserNotification(string username, string email, string title, string img, NotificationType type)
|
private async Task PublishUserNotification(string username, string email, string title, string img, NotificationType type, RequestType requestType)
|
||||||
{
|
{
|
||||||
var notificationModel = new NotificationModel
|
var notificationModel = new NotificationModel
|
||||||
{
|
{
|
||||||
|
@ -167,7 +167,7 @@ namespace Ombi.Services.Notification
|
||||||
UserEmail = email,
|
UserEmail = email,
|
||||||
NotificationType = type,
|
NotificationType = type,
|
||||||
Title = title,
|
Title = title,
|
||||||
ImgSrc = img
|
ImgSrc = requestType == RequestType.Movie ? $"https://image.tmdb.org/t/p/w300/{img}" : img
|
||||||
};
|
};
|
||||||
|
|
||||||
// Send the notification to the user.
|
// Send the notification to the user.
|
||||||
|
|
|
@ -351,7 +351,8 @@ namespace Ombi.UI.Modules
|
||||||
NotificationType = NotificationType.Issue,
|
NotificationType = NotificationType.Issue,
|
||||||
Title = originalRequest.Title,
|
Title = originalRequest.Title,
|
||||||
DateTime = DateTime.Now,
|
DateTime = DateTime.Now,
|
||||||
Body = issue == IssueState.Other ? comment : issue.ToString().ToCamelCaseWords()
|
Body = issue == IssueState.Other ? comment : issue.ToString().ToCamelCaseWords(),
|
||||||
|
ImgSrc = originalRequest.Type == RequestType.Movie ? $"https://image.tmdb.org/t/p/w300/{originalRequest.PosterPath}" : originalRequest.PosterPath
|
||||||
};
|
};
|
||||||
await NotificationService.Publish(model);
|
await NotificationService.Publish(model);
|
||||||
|
|
||||||
|
|
|
@ -1277,7 +1277,8 @@ namespace Ombi.UI.Modules
|
||||||
User = Username,
|
User = Username,
|
||||||
DateTime = DateTime.Now,
|
DateTime = DateTime.Now,
|
||||||
NotificationType = NotificationType.NewRequest,
|
NotificationType = NotificationType.NewRequest,
|
||||||
RequestType = model.Type
|
RequestType = model.Type,
|
||||||
|
ImgSrc = model.Type == RequestType.Movie ? $"https://image.tmdb.org/t/p/w300/{model.PosterPath}" : model.PosterPath
|
||||||
};
|
};
|
||||||
await NotificationService.Publish(notificationModel);
|
await NotificationService.Publish(notificationModel);
|
||||||
}
|
}
|
||||||
|
@ -1315,7 +1316,8 @@ namespace Ombi.UI.Modules
|
||||||
User = Username,
|
User = Username,
|
||||||
DateTime = DateTime.Now,
|
DateTime = DateTime.Now,
|
||||||
NotificationType = NotificationType.NewRequest,
|
NotificationType = NotificationType.NewRequest,
|
||||||
RequestType = model.Type
|
RequestType = model.Type,
|
||||||
|
ImgSrc = model.Type == RequestType.Movie ? $"https://image.tmdb.org/t/p/w300/{model.PosterPath}" : model.PosterPath
|
||||||
};
|
};
|
||||||
await NotificationService.Publish(notificationModel);
|
await NotificationService.Publish(notificationModel);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue