An ObjectId carries its creation second and a per-process counter, so two avatars made one after the other by the same login got ids a few counts apart: a link between personas that every Mastodon client would have seen. Avatar and Group now generate ids from the UTC day plus eight random bytes (still valid ObjectIds), and a remote post's id is made from its published time with a random tail, so posts page in the order they were written rather than the order they arrived. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzABvBkbcFqoHdmi8b9WB
59 lines
1.6 KiB
C#
59 lines
1.6 KiB
C#
using MongoDB.Entities;
|
|
|
|
using PrivaPub.Infrastructure.Ids;
|
|
|
|
namespace PrivaPub.Models.Group
|
|
{
|
|
public class Group : Entity
|
|
{
|
|
public string UserName { get; set; }//preferredUsername
|
|
public string Name { get; set; }//name
|
|
public string Description { get; set; }//summary, Markdown
|
|
|
|
public string Url { get; set; }
|
|
public string Domain { get; set; }
|
|
public string InboxURL { get; set; }
|
|
public string OutboxURL { get; set; }
|
|
public string PictureURL { get; set; }//icon
|
|
public string ThumbnailURL { get; set; }//image
|
|
public string PrivateKey { get; set; }
|
|
public string PublicKey { get; set; }
|
|
|
|
public GroupKind Kind { get; set; }
|
|
public bool IsDiscoverable { get; set; } = true;
|
|
public bool ManuallyApprovesMembers { get; set; }
|
|
public string OwnerAvatarId { get; set; }
|
|
public List<GroupMember> Members { get; set; } = new();
|
|
|
|
public string InvitationCode { get; set; }
|
|
public string HashedInvitationPassword { get; set; }
|
|
|
|
public DateTime CreationDate { get; set; } = DateTime.UtcNow;
|
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
|
public DateTime? DeletionAt { get; set; }
|
|
|
|
public override object GenerateNewID() => PrivacyIds.ForDay(DateTime.UtcNow);
|
|
}
|
|
|
|
public class GroupMember
|
|
{
|
|
public string AvatarId { get; set; }//local Avatar.ID, or the actor URI when IsForeign
|
|
public bool IsForeign { get; set; }
|
|
public GroupRole Role { get; set; } = GroupRole.Member;
|
|
public DateTime JoinedAt { get; set; } = DateTime.UtcNow;
|
|
}
|
|
|
|
public enum GroupKind
|
|
{
|
|
Circle,
|
|
Community
|
|
}
|
|
|
|
public enum GroupRole
|
|
{
|
|
Member,
|
|
Moderator,
|
|
Owner
|
|
}
|
|
}
|