45 lines
1.8 KiB
C#
45 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;
|
||
|
|
}
|
||
|
|
}
|