[backend/masto-client] Populate Status.tags

This commit is contained in:
Kopper 2025-01-20 15:50:24 +03:00 committed by Laura Hausmann
parent ad00ddd14e
commit 7e3320e3b1
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
2 changed files with 18 additions and 4 deletions

View file

@ -89,6 +89,13 @@ public class NoteRenderer(
? await GetReactionsAsync([note], user)
: [..data.Reactions.Where(p => p.NoteId == note.Id)];
var tags = note.Tags.Select(tag => new StatusTags
{
Name = tag,
Url = $"https://{config.Value.WebDomain}/tags/{tag}"
})
.ToList();
var mentionedUsers = mentions.Select(p => new Note.MentionedUser
{
Host = p.Host ?? config.Value.AccountDomain,
@ -196,6 +203,7 @@ public class NoteRenderer(
Emojis = noteEmoji,
Poll = poll,
Reactions = reactions,
Tags = tags,
Filtered = filterResult,
Pleroma = new PleromaStatusExtensions { Reactions = reactions, ConversationId = note.ThreadId }
};

View file

@ -46,10 +46,10 @@ public class StatusEntity : IEntity, ICloneable
[J("media_attachments")] public required List<AttachmentEntity> Attachments { get; set; }
[J("emojis")] public required List<EmojiEntity> Emojis { get; set; }
[J("reactions")] public required List<ReactionEntity> Reactions { get; set; }
[J("tags")] public required List<StatusTags> Tags { get; set; }
[J("tags")] public object[] Tags => []; //FIXME
[J("card")] public object? Card => null; //FIXME
[J("application")] public object? Application => null; //FIXME
[J("card")] public object? Card => null; //FIXME
[J("application")] public object? Application => null; //FIXME
[J("language")] public string? Language => null; //FIXME
@ -106,4 +106,10 @@ public class StatusEdit
[J("poll")] public required PollEntity? Poll { get; set; }
[J("media_attachments")] public required List<AttachmentEntity> Attachments { get; set; }
[J("emojis")] public required List<EmojiEntity> Emojis { get; set; }
}
}
public class StatusTags
{
[J("name")] public required string Name { get; set; }
[J("url")] public required string Url { get; set; }
}