[backend/federation] Include alt text for avatar and banner in UserRenderer

This commit is contained in:
pancakes 2024-12-18 18:41:13 +10:00 committed by Laura Hausmann
parent 207249280f
commit fdadc41c61
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
2 changed files with 5 additions and 3 deletions

View file

@ -714,7 +714,9 @@ public static class QueryableExtensions
public static IQueryable<User> IncludeCommonProperties(this IQueryable<User> query)
{
return query.Include(p => p.UserProfile);
return query.Include(p => p.UserProfile)
.Include(p => p.Avatar)
.Include(p => p.Banner);
}
public static IQueryable<Bite> IncludeCommonProperties(this IQueryable<Bite> query)

View file

@ -111,10 +111,10 @@ public class UserRenderer(
MovedTo = user.MovedToUri is not null ? new ASLink(user.MovedToUri) : null,
Featured = new ASOrderedCollection($"{id}/collections/featured"),
Avatar = user.Avatar != null
? new ASImage { Url = new ASLink(user.Avatar.RawAccessUrl) }
? new ASImage { Url = new ASLink(user.Avatar.RawAccessUrl), Description = user.Avatar?.Comment }
: null,
Banner = user.Banner != null
? new ASImage { Url = new ASLink(user.Banner.RawAccessUrl) }
? new ASImage { Url = new ASLink(user.Banner.RawAccessUrl), Description = user.Banner?.Comment }
: null,
Endpoints = new ASEndpoints { SharedInbox = new ASObjectBase($"https://{config.Value.WebDomain}/inbox") },
PublicKey = new ASPublicKey