Files
SocialPub/PrivaPub/Models/Social/ConversationState.cs
T
thepraandClaude Opus 5.5 17922f4dfd Conversations page, and know what is unread
/api/v1/conversations answered one page, never unread, its read endpoint
did nothing, and DELETE was missing; each conversation cost a query per
member. Now each conversation keeps its newest post (DmGroup.LastPostId,
set as posts arrive, learnt once by migration _013) and pages by it as
Mastodon does, and each persona's ConversationState holds what it read and
what it took off its list:

- unread when someone else wrote last, after what the persona read;
- read marks it so, and writing in a conversation reads it;
- DELETE takes it off the list until a newer message brings it back.

The list reads its states, newest posts, members and accounts in a few
queries per page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
2026-10-05 05:37:28 +02:00

16 lines
575 B
C#

using MongoDB.Entities;
namespace PrivaPub.Models.Social
{
// how far a persona has read a direct conversation, and up to which post it took the conversation off its list
// (Mastodon's DELETE /api/v1/conversations/:id): a newer message brings it back, unread. Post ids, compared as strings.
public class ConversationState : Entity
{
public string AvatarId { get; set; }
public string ConversationId { get; set; }
public string LastReadPostId { get; set; }
public string HiddenUpTo { get; set; }
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}
}