Revert "[backend/api] Add missing inclusions of user avatar and banner"

This reverts commit b4084b8e2222d0935fb536feac78d5ed31dc6fa5.
This commit is contained in:
pancakes 2025-02-04 22:46:59 +10:00 committed by Laura Hausmann
parent 82a2331ae0
commit 36c6092fd2
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
4 changed files with 3 additions and 33 deletions

View file

@ -119,16 +119,12 @@ public class InstanceController(
{ {
var admins = db.Users var admins = db.Users
.Where(p => p.IsAdmin == true) .Where(p => p.IsAdmin == true)
.Include(p => p.Avatar)
.Include(p => p.Banner)
.OrderBy(p => p.UsernameLower); .OrderBy(p => p.UsernameLower);
var adminList = await userRenderer.RenderManyAsync(admins) var adminList = await userRenderer.RenderManyAsync(admins)
.ToListAsync(); .ToListAsync();
var moderators = db.Users var moderators = db.Users
.Where(p => p.IsAdmin == false && p.IsModerator == true) .Where(p => p.IsAdmin == false && p.IsModerator == true)
.Include(p => p.Avatar)
.Include(p => p.Banner)
.OrderBy(p => p.UsernameLower); .OrderBy(p => p.UsernameLower);
var moderatorList = await userRenderer.RenderManyAsync(moderators) var moderatorList = await userRenderer.RenderManyAsync(moderators)
.ToListAsync(); .ToListAsync();

View file

@ -159,7 +159,6 @@ public class NoteController(
var users = await db.NoteReactions var users = await db.NoteReactions
.Where(p => p.Note == note && p.Reaction == $":{name.Trim(':')}:") .Where(p => p.Note == note && p.Reaction == $":{name.Trim(':')}:")
.Include(p => p.User.Avatar)
.Include(p => p.User.UserProfile) .Include(p => p.User.UserProfile)
.Select(p => p.User) .Select(p => p.User)
.ToListAsync(); .ToListAsync();
@ -245,7 +244,6 @@ public class NoteController(
var users = await db.NoteLikes var users = await db.NoteLikes
.Where(p => p.Note == note) .Where(p => p.Note == note)
.Include(p => p.User.Avatar)
.Include(p => p.User.UserProfile) .Include(p => p.User.UserProfile)
.Paginate(pq, ControllerContext) .Paginate(pq, ControllerContext)
.Wrap(p => p.User) .Wrap(p => p.User)
@ -311,7 +309,6 @@ public class NoteController(
var users = await db.Notes var users = await db.Notes
.Where(p => p.Renote == note && p.IsPureRenote) .Where(p => p.Renote == note && p.IsPureRenote)
.EnsureVisibleFor(user) .EnsureVisibleFor(user)
.Include(p => p.User.Avatar)
.Include(p => p.User.UserProfile) .Include(p => p.User.UserProfile)
.FilterHidden(user, db) .FilterHidden(user, db)
.Paginate(pq, ControllerContext) .Paginate(pq, ControllerContext)

View file

@ -46,15 +46,6 @@ public class UserRenderer(IOptions<Config.InstanceSection> config, DatabaseConte
var emojis = await GetEmojisAsync([user]); var emojis = await GetEmojisAsync([user]);
var data = new UserRendererDto { Emojis = emojis, InstanceData = instanceData }; var data = new UserRendererDto { Emojis = emojis, InstanceData = instanceData };
user.Avatar ??= await db.Users.Where(p => p.Id == user.Id)
.Include(p => p.Avatar)
.Select(p => p.Avatar)
.FirstOrDefaultAsync();
user.Banner ??= await db.Users.Where(p => p.Id == user.Id)
.Include(p => p.Banner)
.Select(p => p.Banner)
.FirstOrDefaultAsync();
return Render(user, data); return Render(user, data);
} }

View file

@ -601,13 +601,9 @@ public static class QueryableExtensions
public static IQueryable<Note> IncludeCommonProperties(this IQueryable<Note> query) public static IQueryable<Note> IncludeCommonProperties(this IQueryable<Note> query)
{ {
return query.Include(p => p.User.Avatar) return query.Include(p => p.User.UserProfile)
.Include(p => p.User.UserProfile)
.Include(p => p.Renote.User.Avatar)
.Include(p => p.Renote.User.UserProfile) .Include(p => p.Renote.User.UserProfile)
.Include(p => p.Renote.Renote.User.Avatar)
.Include(p => p.Renote.Renote.User.UserProfile) .Include(p => p.Renote.Renote.User.UserProfile)
.Include(p => p.Reply.User.Avatar)
.Include(p => p.Reply.User.UserProfile); .Include(p => p.Reply.User.UserProfile);
} }
@ -625,9 +621,7 @@ public static class QueryableExtensions
public static IQueryable<FollowRequest> IncludeCommonProperties(this IQueryable<FollowRequest> query) public static IQueryable<FollowRequest> IncludeCommonProperties(this IQueryable<FollowRequest> query)
{ {
return query.Include(p => p.Follower.Avatar) return query.Include(p => p.Follower.UserProfile)
.Include(p => p.Follower.UserProfile)
.Include(p => p.Followee.Avatar)
.Include(p => p.Followee.UserProfile); .Include(p => p.Followee.UserProfile);
} }
@ -649,21 +643,13 @@ public static class QueryableExtensions
public static IQueryable<Notification> IncludeCommonProperties(this IQueryable<Notification> query) public static IQueryable<Notification> IncludeCommonProperties(this IQueryable<Notification> query)
{ {
return query.Include(p => p.Notifiee.Avatar) return query.Include(p => p.Notifiee.UserProfile)
.Include(p => p.Notifiee.UserProfile)
.Include(p => p.Notifier.Avatar)
.Include(p => p.Notifier.UserProfile) .Include(p => p.Notifier.UserProfile)
.Include(p => p.Note.User.Avatar)
.Include(p => p.Note.User.UserProfile) .Include(p => p.Note.User.UserProfile)
.Include(p => p.Note.Renote.User.Avatar)
.Include(p => p.Note.Renote.User.UserProfile) .Include(p => p.Note.Renote.User.UserProfile)
.Include(p => p.Note.Renote.Renote.User.Avatar)
.Include(p => p.Note.Renote.Renote.User.UserProfile) .Include(p => p.Note.Renote.Renote.User.UserProfile)
.Include(p => p.Note.Reply.User.Avatar)
.Include(p => p.Note.Reply.User.UserProfile) .Include(p => p.Note.Reply.User.UserProfile)
.Include(p => p.FollowRequest.Follower.Avatar)
.Include(p => p.FollowRequest.Follower.UserProfile) .Include(p => p.FollowRequest.Follower.UserProfile)
.Include(p => p.FollowRequest.Followee.Avatar)
.Include(p => p.FollowRequest.Followee.UserProfile) .Include(p => p.FollowRequest.Followee.UserProfile)
.Include(p => p.Bite); .Include(p => p.Bite);
} }