Include creator in photos db call

This commit is contained in:
jvyden 2022-01-31 00:21:53 -05:00
commit 8de0903cee
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278

View file

@ -4,7 +4,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using JetBrains.Annotations;
using LBPUnion.ProjectLighthouse.Helpers;
using LBPUnion.ProjectLighthouse.Pages.Layouts;
using LBPUnion.ProjectLighthouse.Types;
using LBPUnion.ProjectLighthouse.Types.Settings;
@ -40,8 +39,9 @@ public class PhotosPage : BaseLayout
if (this.PageNumber < 0 || this.PageNumber >= this.PageAmount) return this.Redirect($"/photos/{Math.Clamp(this.PageNumber, 0, this.PageAmount - 1)}");
this.Photos = await this.Database.Photos.Where
(p => p.Creator.Username.Contains(name) || p.PhotoSubjectCollection.Contains(name))
this.Photos = await this.Database.Photos.Include
(p => p.Creator)
.Where(p => p.Creator.Username.Contains(name) || p.PhotoSubjectCollection.Contains(name))
.OrderByDescending(p => p.Timestamp)
.Skip(pageNumber * ServerStatics.PageSize)
.Take(ServerStatics.PageSize)