don't query the session as much in the modules, rely on a variable from the base class and store the username as needed

This commit is contained in:
Drewster727 2016-03-30 11:06:35 -05:00
parent a028a68a08
commit a668ea04ec
4 changed files with 29 additions and 15 deletions

View file

@ -84,7 +84,7 @@ namespace PlexRequests.UI.Modules
var dbMovies = Service.GetAll().Where(x => x.Type == RequestType.Movie);
if (settings.UsersCanViewOnlyOwnRequests && !isAdmin)
{
dbMovies = dbMovies.Where(x => x.UserHasRequested(Session[SessionKeys.UsernameKey].ToString()));
dbMovies = dbMovies.Where(x => x.UserHasRequested(Username));
}
var viewModel = dbMovies.Select(movie => {
@ -127,7 +127,7 @@ namespace PlexRequests.UI.Modules
var dbTv = Service.GetAll().Where(x => x.Type == RequestType.TvShow);
if (settings.UsersCanViewOnlyOwnRequests && !isAdmin)
{
dbTv = dbTv.Where(x => x.UserHasRequested(Session[SessionKeys.UsernameKey].ToString()));
dbTv = dbTv.Where(x => x.UserHasRequested(Username));
}
var viewModel = dbTv.Select(tv => {
@ -194,7 +194,7 @@ namespace PlexRequests.UI.Modules
}
originalRequest.Issues = issue;
originalRequest.OtherMessage = !string.IsNullOrEmpty(comment)
? $"{Session[SessionKeys.UsernameKey]} - {comment}"
? $"{Username} - {comment}"
: string.Empty;
@ -202,7 +202,7 @@ namespace PlexRequests.UI.Modules
var model = new NotificationModel
{
User = Session[SessionKeys.UsernameKey].ToString(),
User = Username,
NotificationType = NotificationType.Issue,
Title = originalRequest.Title,
DateTime = DateTime.Now,