feat(inbox): automatically mark inbox items read when reading or viewing conversation

This commit is contained in:
tyuXX 2026-10-31 16:28:58 +03:00
parent dcccc67d3e
commit 0de9c40337
6 changed files with 145 additions and 4 deletions

View file

@ -477,6 +477,29 @@ public class ClientState
}
}
public int MarkChannelInboxItemsReadLocally(string channelId)
{
if (string.IsNullOrEmpty(channelId)) return 0;
lock (_lock)
{
int changed = 0;
foreach (var item in InboxItems)
{
if (string.Equals(item.ChannelId, channelId, StringComparison.OrdinalIgnoreCase) && !item.IsRead)
{
item.IsRead = true;
changed++;
}
}
if (changed > 0)
{
UnreadInboxCount = Math.Max(0, UnreadInboxCount - changed);
NeedsRedraw = true;
}
return changed;
}
}
public List<InboxItem> GetInboxItems()
{
lock (_lock)