R7 custom emoji in decePub: the server's own, administered, picked, suggested and shown

Administration has a Custom emoji section (EmojiPanel, data-admin-section=emoji): the server's emoji by category, added
with a picture streamed from the file, changed (category, picker, disabled, picture; never the shortcode) and deleted,
asked first, with PrivaPub's 409 and 422 in the dialog. EmojiService reads /clientapi/admin/emoji and, for everyone,
/api/v1/custom_emojis, kept a day in localStorage (CustomEmojiCache) and read again after a change here. EmojiPicker
(a DDropdown sheet on a phone, rendered only while open) offers them by category with common unicode emoji, searchable:
the composer writes the choice at the caret, a card and the announcements banner react with it. The composer suggests
custom emoji after `:` and two letters. Custom reactions toggle as :shortcode: and show their picture, notifications of
one too; located posts, announcements and NavMenu's persona names render the server's emoji.

Verified: Release build, 0 errors (the 3 warnings were there before). Not run against PrivaPub or in the pasture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WpVCoDeM1qUTRp4fXQdfof
This commit is contained in:
thepraandClaude Opus 5.5 committed 2026-10-18 08:24:43 +02:00
1 parent c572471b88
commit 566b0e33ea
26 files changed
+1385 -56

No files matched your search

+5
View File
@@ -78,6 +78,10 @@ public static class APIs
public const string GET_AdminRelays = "clientapi/admin/relays";
public const string POST_AdminRelayInsert = "clientapi/admin/relays/insert";
public static string POST_M_AdminRelayDelete(string address) => $"clientapi/admin/relays/delete?address={Uri.EscapeDataString(address)}";
public const string GET_AdminEmojis = "clientapi/admin/emoji/list";
public const string POST_AdminEmojiInsert = "clientapi/admin/emoji/insert";
public const string POST_AdminEmojiUpdate = "clientapi/admin/emoji/update";
public static string POST_M_AdminEmojiDelete(string shortcode) => $"clientapi/admin/emoji/delete?shortcode={Uri.EscapeDataString(shortcode)}";
public const string GET_AdminDomainBlocks = "clientapi/admin/domainblocks/list";
public const string POST_AdminDomainBlock = "clientapi/admin/domainblocks/insert";
public static string POST_M_AdminDomainUnblock(string domain) => $"clientapi/admin/domainblocks/delete?domain={Uri.EscapeDataString(domain)}";
@@ -145,6 +149,7 @@ public static class APIs
public const string GET_InstanceTermsOfService = "api/v1/instance/terms_of_service";
public const string GET_InstanceDomainBlocks = "api/v1/instance/domain_blocks";
public const string GET_Announcements = "api/v1/announcements";
public const string GET_CustomEmojis = "api/v1/custom_emojis";
public static string POST_M_DismissAnnouncement(string announcementId) => $"api/v1/announcements/{Uri.EscapeDataString(announcementId)}/dismiss";
public static string M_AnnouncementReaction(string announcementId, string emoji) =>
$"api/v1/announcements/{Uri.EscapeDataString(announcementId)}/reactions/{Uri.EscapeDataString(emoji)}";
+14
View File
@@ -0,0 +1,14 @@
using decePubClient.Models.Mastodon;
namespace decePubClient.Models;
/// <summary>
/// The server's custom emoji its picker offers (/api/v1/custom_emojis), as EmojiService last read them: kept in
/// localStorage under its type name and used for a day, then read again (at once after an administrator changes one in
/// this client).
/// </summary>
public class CustomEmojiCache
{
public DateTime FetchedAt { get; set; }
public List<CustomEmoji> Emojis { get; set; } = [];
}
+1
View File
@@ -72,6 +72,7 @@ public class FeedPost
Account = sample.FirstOrDefault(),
Status = status,
Emoji = group.Emoji,
EmojiUrl = group.EmojiUrl,
GroupKey = group.GroupKey,
ModerationWarning = group.ModerationWarning
},
+4
View File
@@ -73,11 +73,15 @@ public class AccountField
public DateTime? VerifiedAt { get; set; }
}
/// <summary>A custom emoji: one a post or an account names (its server's), or one of this server's own as
/// /api/v1/custom_emojis lists them for the picker, with its category.</summary>
public class CustomEmoji
{
public string Shortcode { get; set; }
public string Url { get; set; }
public string StaticUrl { get; set; }
public bool VisibleInPicker { get; set; }
public string Category { get; set; }
}
public class Relationship
+5 -1
View File
@@ -15,15 +15,19 @@ public class Announcement
/// <summary>Whether the persona dismissed it.</summary>
public bool? Read { get; set; }
public List<AnnouncementReaction> Reactions { get; set; } = [];
/// <summary>The server's custom emoji its text names.</summary>
public List<CustomEmoji> Emojis { get; set; } = [];
}
/// <summary>A unicode emoji chosen on an announcement, how many personas chose it, and whether this one did.</summary>
/// <summary>An emoji chosen on an announcement (a unicode one, or the shortcode of one of the server's custom emoji, which
/// has its pictures), how many personas chose it, and whether this one did.</summary>
public class AnnouncementReaction
{
public string Name { get; set; }
public int Count { get; set; }
public bool? Me { get; set; }
public string Url { get; set; }
public string StaticUrl { get; set; }
}
/// <summary>The streaming API's announcement.reaction payload: the emoji, how many chose it now, and on which.</summary>
+4
View File
@@ -11,7 +11,10 @@ public class Notification
public DateTime CreatedAt { get; set; }
public Account Account { get; set; }
public Status Status { get; set; }
/// <summary>A reaction's emoji: the emoji itself, or a custom emoji's shortcode.</summary>
public string Emoji { get; set; }
/// <summary>A custom emoji reaction's picture.</summary>
public string EmojiUrl { get; set; }
/// <summary>The group it belongs to (likes and boosts of one post, follows within an hour), or ungrouped-{id}.</summary>
public string GroupKey { get; set; }
/// <summary>A moderation_warning's: what this server's staff did and told the persona. Its Account is the persona
@@ -52,6 +55,7 @@ public class NotificationGroup
public List<string> SampleAccountIds { get; set; } = [];
public string StatusId { get; set; }
public string Emoji { get; set; }
public string EmojiUrl { get; set; }
/// <summary>A moderation_warning group's newest warning.</summary>
public AccountWarning ModerationWarning { get; set; }
}