[backend/masto-client] Add avatar_description and header_description to AccountEntity
This commit is contained in:
parent
6f69ae6ffb
commit
82a2331ae0
2 changed files with 14 additions and 0 deletions
|
@ -45,6 +45,15 @@ public class UserRenderer(
|
||||||
? profile?.Fields.Select(p => new Field { Name = p.Name, Value = p.Value }).ToList() ?? []
|
? profile?.Fields.Select(p => new Field { Name = p.Name, Value = p.Value }).ToList() ?? []
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
var res = new AccountEntity
|
var res = new AccountEntity
|
||||||
{
|
{
|
||||||
Id = user.Id,
|
Id = user.Id,
|
||||||
|
@ -62,8 +71,10 @@ public class UserRenderer(
|
||||||
Url = profile?.Url ?? user.Uri ?? user.GetPublicUrl(config.Value),
|
Url = profile?.Url ?? user.Uri ?? user.GetPublicUrl(config.Value),
|
||||||
Uri = user.Uri ?? user.GetPublicUri(config.Value),
|
Uri = user.Uri ?? user.GetPublicUri(config.Value),
|
||||||
AvatarStaticUrl = user.GetAvatarUrl(config.Value), //TODO
|
AvatarStaticUrl = user.GetAvatarUrl(config.Value), //TODO
|
||||||
|
AvatarDescription = user.Avatar?.Comment ?? "",
|
||||||
HeaderUrl = user.GetBannerUrl(config.Value) ?? _transparent,
|
HeaderUrl = user.GetBannerUrl(config.Value) ?? _transparent,
|
||||||
HeaderStaticUrl = user.GetBannerUrl(config.Value) ?? _transparent, //TODO
|
HeaderStaticUrl = user.GetBannerUrl(config.Value) ?? _transparent, //TODO
|
||||||
|
HeaderDescription = user.Banner?.Comment ?? "",
|
||||||
MovedToAccount = null, //TODO
|
MovedToAccount = null, //TODO
|
||||||
IsBot = user.IsBot,
|
IsBot = user.IsBot,
|
||||||
IsDiscoverable = user.IsExplorable,
|
IsDiscoverable = user.IsExplorable,
|
||||||
|
|
|
@ -28,6 +28,9 @@ public class AccountEntity : IEntity
|
||||||
[J("source")] public AccountSource? Source { get; set; }
|
[J("source")] public AccountSource? Source { get; set; }
|
||||||
[J("emojis")] public required List<EmojiEntity> Emoji { get; set; }
|
[J("emojis")] public required List<EmojiEntity> Emoji { get; set; }
|
||||||
[J("id")] public required string Id { get; set; }
|
[J("id")] public required string Id { get; set; }
|
||||||
|
|
||||||
|
[J("avatar_description")] public required string AvatarDescription { get; set; }
|
||||||
|
[J("header_description")] public required string HeaderDescription { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Field
|
public class Field
|
||||||
|
|
Loading…
Add table
Reference in a new issue