- A post's flairs are read in both dialects: Lemmy 1.0's CommunityPostTag (id, slug, name, description, colour slot) and PieFed's lemmy:CommunityTag (display name, text and background colours, whether to blur images). Colours are kept only as a colour slot or a hex value. - A community's own list comes from its `tag` and PieFed's older `lemmy:tagsForPosts`, and fills in a post that names only a flair's id and slug, as Lemmy's posts do. Edits and refreshes keep them current. - Clients get them as `privapub.flairs`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzABvBkbcFqoHdmi8b9WB
This commit is contained in:
1 parent
587997dd67
commit
d4b1788a4f
14 files changed
+172
-3
No files matched your search
@@ -79,6 +79,7 @@
|
||||
public PrivaPubPlace Place { get; set; }//a remote post's own place (Pixelfed), shown only
|
||||
public Account Wall { get; set; }//whose wall it was written on (FEP-400e), when not its author's
|
||||
public PrivaPubVotes Votes { get; set; } = new();
|
||||
public List<PrivaPubFlair> Flairs { get; set; } = new();
|
||||
}
|
||||
|
||||
public class PrivaPubSource
|
||||
@@ -163,6 +164,18 @@
|
||||
public string Url { get; set; }
|
||||
}
|
||||
|
||||
public class PrivaPubFlair
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Slug { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Color { get; set; }
|
||||
public string TextColor { get; set; }
|
||||
public string BackgroundColor { get; set; }
|
||||
public bool BlurImages { get; set; }
|
||||
}
|
||||
|
||||
public class PrivaPubVotes
|
||||
{
|
||||
public int Up { get; set; }
|
||||
|
||||
@@ -543,7 +543,12 @@ namespace PrivaPub.Api.Mastodon.Mappers
|
||||
{
|
||||
Name = post.Place.Name, Latitude = post.Place.Latitude, Longitude = post.Place.Longitude, Country = post.Place.Country
|
||||
},
|
||||
Votes = new PrivaPubVotes { Up = post.FavouritesCount, Down = post.DownvotesCount }
|
||||
Votes = new PrivaPubVotes { Up = post.FavouritesCount, Down = post.DownvotesCount },
|
||||
Flairs = post.Flairs?.Select(f => new PrivaPubFlair
|
||||
{
|
||||
Id = f.Id, Name = f.Name, Slug = f.Slug, Description = f.Description, Color = f.Color, TextColor = f.TextColor,
|
||||
BackgroundColor = f.BackgroundColor, BlurImages = f.BlurImages
|
||||
}).ToList() ?? new()
|
||||
};
|
||||
|
||||
PrivaPubVariant Variant(MediaVariant variant) => new()
|
||||
|
||||
Reference in new issue
Block a user