[backend/masto-client] Improve account/status url/uri field compatibility

This commit is contained in:
Laura Hausmann 2024-06-05 17:44:48 +02:00
parent 24fd34755a
commit 004d89e78a
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
4 changed files with 4 additions and 2 deletions

View file

@ -115,7 +115,7 @@ public class NoteRenderer(
{
Id = note.Id,
Uri = uri,
Url = note.Url ?? uri,
Url = note.Url,
Account = account,
ReplyId = note.ReplyId,
ReplyUserId = note.MastoReplyUserId ?? note.ReplyUserId,

View file

@ -55,6 +55,7 @@ public class UserRenderer(IOptions<Config.InstanceSection> config, MfmConverter
StatusesCount = user.NotesCount,
Note = await mfmConverter.ToHtmlAsync(profile?.Description ?? "", mentions, user.Host),
Url = profile?.Url ?? user.Uri ?? user.GetPublicUrl(config.Value),
Uri = user.Uri ?? user.GetPublicUri(config.Value),
AvatarStaticUrl = user.AvatarUrl ?? user.GetIdenticonUrlPng(config.Value), //TODO
HeaderUrl = user.BannerUrl ?? _transparent,
HeaderStaticUrl = user.BannerUrl ?? _transparent, //TODO

View file

@ -16,6 +16,7 @@ public class AccountEntity : IEntity
[J("statuses_count")] public required long StatusesCount { get; set; }
[J("note")] public required string Note { get; set; }
[J("url")] public required string Url { get; set; }
[J("url")] public required string Uri { get; set; }
[J("avatar")] public required string AvatarUrl { get; set; }
[J("avatar_static")] public required string AvatarStaticUrl { get; set; }
[J("header")] public required string HeaderUrl { get; set; }

View file

@ -13,7 +13,7 @@ public class StatusEntity : IEntity, ICloneable
[J("text")] public required string? Text { get; set; }
[J("content")] public required string? Content { get; set; }
[J("uri")] public required string Uri { get; set; }
[J("url")] public required string Url { get; set; }
[J("url")] public required string? Url { get; set; }
[J("account")] public required AccountEntity Account { get; set; }
[J("in_reply_to_id")] public required string? ReplyId { get; set; }
[J("in_reply_to_account_id")] public required string? ReplyUserId { get; set; }