mirror of
https://github.com/Govor-team/Govor.git
synced 2026-09-20 18:03:07 +00:00
Add read receipts and editing limits
Introduced message read tracking with a dedicated MessageReadingService, SignalR read request/response contracts, and hub notification flow for read receipts. Added configurable message edit constraints through MessageEditingOptions and a shared INowDateTimeProvider so timestamps are consistent across the app. Also fixed recipient validation in message removal and improved push token upsert behavior by matching the correct user/session record.
This commit is contained in:
@@ -5,8 +5,9 @@ public static class ChatHubConstants
|
||||
public const string ReceiveMessage = "ReceiveMessage";
|
||||
public const string MessageSent = "MessageSent";
|
||||
public const string MessageRemoved = "MessageRemoved";
|
||||
public const string MessageEdited = "MessageEdit";
|
||||
|
||||
public const string MessageEdited = "MessageEdited";
|
||||
public static string MessageRead = "MessageReaded";
|
||||
|
||||
public static string GetUserGroup(Guid userId) => userId.ToString();
|
||||
public static string GetChatGroup(Guid groupId) => $"group_{groupId}";
|
||||
public static string GetPrivateChat(Guid groupId) => $"private_{groupId}";
|
||||
|
||||
@@ -45,6 +45,16 @@ public class ChatNotificationService : IChatNotificationService
|
||||
// .SendAsync(ChatHubConstants.MessageSent, message);
|
||||
}
|
||||
|
||||
public async Task NotifyMessageWasReadAsync(MessageReadResponse response)
|
||||
{
|
||||
await NotifyParticipantsAsync(
|
||||
response.ReaderId,
|
||||
response.RecipientId,
|
||||
response.RecipientType,
|
||||
ChatHubConstants.MessageRead,
|
||||
response);
|
||||
}
|
||||
|
||||
private async Task NotifyMessageReceivedInPrivateChatAsync(UserMessageResponse message)
|
||||
{
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace Govor.API.Hubs.Infrastructure;
|
||||
public interface IChatNotificationService
|
||||
{
|
||||
Task NotifyMessageSentAsync(UserMessageResponse message);
|
||||
Task NotifyMessageWasReadAsync(MessageReadResponse response);
|
||||
Task NotifyMessageRemovedAsync(MessageRemovedResponse response);
|
||||
Task NotifyMessageEditedAsync(MessageEditResponse response);
|
||||
}
|
||||
Reference in New Issue
Block a user