Files
SocialPub/PrivaPub/Models/AdminAction.cs
T
thepraandClaude Opus 5.5 d08fbabaa5 R7 custom emoji: the server's own, added by administrators, sent on posts, profiles and reactions
LocalEmoji, a new collection (unique shortcode whatever its case, never renamed: the shortcode is its id elsewhere),
managed on /clientapi/admin/emoji/list|insert|update|delete and kept in the staff's log (emoji.insert, .update,
.delete). Its picture goes through IMediaService.EmojiImage: PNG, GIF, WebP or JPEG up to 256 KB, a PNG within 256 px
with alpha kept (an animated GIF or WebP stays an animated GIF, with a still PNG), keep=none, shrunk until it fits
GoToSocial's 100 KiB, held by ServerUse "emoji:<shortcode>" so the janitor and the audit leave it. LocalEmojis keeps the
offered ones in memory, reloaded on every change: GET /api/v1/custom_emojis is real; local posts (words, title, warning,
poll options, each revision) and profiles keep the emoji they name; Notes, Questions, actors and EmojiReacts carry
Mastodon's Emoji tag with its id, served as an Emoji at /emojis/{shortcode} (410 once deleted; the path awaits the
owner's confirmation); a persona reacts with one (Pleroma's reactions, announcements). A restore keeps the live emoji
as it keeps the settings, and trashes server pictures nothing holds. tools/pasture/scenarios/emoji.sh joins batch A.

Verified: built, and run locally against a scratch database (uploads of every type, animation kept, metadata gone,
refusals, rendering, reactions, history, announcements, delete and revive, backup and restore, media audit). The
pasture scenario and the sweep were not run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WpVCoDeM1qUTRp4fXQdfof
2026-10-17 05:57:25 +02:00

86 lines
3.8 KiB
C#

using MongoDB.Entities;
namespace PrivaPub.Models
{
// One act of the server's staff, kept for the moderators' log (Domain/Moderation/ModerationLog.cs, completion program
// R5): who (an administrator's or moderator's root id, or "cli" for the command line), what, and on what. Never an IP
// address, and never a root next to its own personas: an entry about a persona drops the acting root when the persona
// is that root's, and an entry about a root names none of its personas. A backup holds the log and a restore keeps
// every entry made since (ProtectiveMerge).
public class AdminAction : Entity
{
public const string Cli = "cli";
public DateTime At { get; set; } = DateTime.UtcNow;
public string ByRootId { get; set; }
public string Action { get; set; }//AdminActions.*
public string TargetKind { get; set; }//AdminTargets.*
public string TargetId { get; set; }
public string TargetLabel { get; set; }
public string ReportId { get; set; }
public string Note { get; set; }
}
public static class AdminActions
{
public const string DomainBlockInsert = "domain_block.insert";
public const string DomainBlockDelete = "domain_block.delete";
public const string BackupCreate = "backup.create";
public const string BackupDelete = "backup.delete";
public const string BackupRestore = "backup.restore";
public const string SettingsUpdate = "settings.update";
public const string SettingsThumbnail = "settings.thumbnail";
public const string RuleInsert = "rule.insert";
public const string RuleUpdate = "rule.update";
public const string RuleDelete = "rule.delete";
public const string AnnouncementInsert = "announcement.insert";
public const string AnnouncementUpdate = "announcement.update";
public const string AnnouncementDelete = "announcement.delete";
public const string RelayInsert = "relay.insert";
public const string RelayDelete = "relay.delete";
public const string ReportResolve = "report.resolve";
public const string RootPromote = "root.promote";
public const string RootDemote = "root.demote";
public const string RootCreate = "root.create";
public const string RootDelete = "root.delete";
public const string RootResetTotp = "root.reset_totp";
public const string PersonaMove = "persona.move";
// moderation (completion program R6)
public const string RootRole = "root.role";
public const string RootBan = "root.ban";
public const string RootUnban = "root.unban";
public const string PersonaSilence = "persona.silence";
public const string PersonaUnsilence = "persona.unsilence";
public const string PersonaSuspend = "persona.suspend";
public const string PersonaUnsuspend = "persona.unsuspend";
public const string PersonaDelete = "persona.delete";
public const string AccountSilence = "account.silence";
public const string AccountUnsilence = "account.unsilence";
public const string AccountSuspend = "account.suspend";
public const string AccountUnsuspend = "account.unsuspend";
public const string GroupDelete = "group.delete";
public const string PostRemove = "post.remove";
// the server's custom emoji (completion program R7)
public const string EmojiInsert = "emoji.insert";
public const string EmojiUpdate = "emoji.update";
public const string EmojiDelete = "emoji.delete";
}
public static class AdminTargets
{
public const string Root = "root";
public const string Persona = "persona";
public const string Account = "account";
public const string Domain = "domain";
public const string Report = "report";
public const string Settings = "settings";
public const string Rule = "rule";
public const string Announcement = "announcement";
public const string Emoji = "emoji";
public const string Relay = "relay";
public const string Backup = "backup";
public const string Group = "group";
public const string Post = "post";
}
}