A persona's notification policy and its requests

Mastodon 4.3's policy was a stub that accepted everything. It is now kept per persona: notifications from accounts it
does not follow, accounts that do not follow it (or only for three days), accounts newer than 30 days, private mentions
it did not ask for and silenced accounts are accepted, filtered or dropped. Filtered ones stay out of every list and
count unless asked for, gathered in a request per account; letting a request in lets that account in for good,
dismissing it deletes them. Everything is accepted until the persona chooses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
This commit is contained in:
thepraandClaude Opus 5.5 committed 2026-10-06 15:48:33 +02:00
1 parent 9872b78677
commit 5d5f1d6909
10 files changed
+511 -29

No files matched your search

+1
View File
@@ -13,6 +13,7 @@ namespace PrivaPub.Models.Social
public string Emoji { get; set; }//a reaction's emoji
public string EmojiURL { get; set; }
public bool IsRead { get; set; }
public bool Filtered { get; set; }//held back by the persona's notification policy, in a NotificationRequest
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
@@ -0,0 +1,45 @@
using MongoDB.Entities;
namespace PrivaPub.Models.Social
{
// Mastodon's notification policy (4.3): what becomes of a notification from an account the persona does not follow, one
// that does not follow it (or only lately), one new to the fediverse, a private mention it did not ask for, or an
// account on a server this one silences. Anything not accepted is filtered (kept, out of the notifications, in a
// request per account) or dropped. Accepted by default, so nothing changes until a persona chooses
public class NotificationPolicy : Entity
{
public string AvatarId { get; set; }
public NotificationAction ForNotFollowing { get; set; } = NotificationAction.Accept;
public NotificationAction ForNotFollowers { get; set; } = NotificationAction.Accept;
public NotificationAction ForNewAccounts { get; set; } = NotificationAction.Accept;
public NotificationAction ForPrivateMentions { get; set; } = NotificationAction.Accept;
public NotificationAction ForLimitedAccounts { get; set; } = NotificationAction.Accept;
}
public enum NotificationAction
{
Accept,
Filter,
Drop
}
// the notifications filtered from one account, waiting for the persona to let them in or dismiss them
public class NotificationRequest : Entity
{
public string AvatarId { get; set; }
public string FromAccountId { get; set; }
public string FromActorURI { get; set; }
public string LastPostId { get; set; }
public int NotificationsCount { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}
// an account whose notifications the persona let in: never filtered again
public class NotificationPermission : Entity
{
public string AvatarId { get; set; }
public string FromActorURI { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
}