Files
SocialPub/PrivaPub/Models/Social/NotificationPolicy.cs
T
thepraandClaude Opus 5.5 5d5f1d6909 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
2026-10-06 15:48:33 +02:00

46 lines
1.8 KiB
C#

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;
}
}