mirror of
https://github.com/Govor-team/Govor.git
synced 2026-11-17 12:59:25 +00:00
Add reactions, reliable push & session checks
Implements message reactions and reaction packs (domain models, services, admin HTTP API, media processing via ImageSharp and limits) and adds reliable push delivery (ChatPushNotification, ChatPushDispatcher, ChatPushWorker, improved ChatNotificationService). Enhances message reading (ReadChat API, unread counts, concurrency-safe receipts) and tightens session security (access-token session validation in JWT, hub filter, SessionAuthorization). Improves SignalR behavior (session groups, reaction/channel events, hub/error mappings). Adds EF migrations, many controller fixes (Forbid handling, password API), tests (Govor.Server.Tests), docs, CI and tooling updates (Dockerfile → .NET 10, GH Actions matrix for sqlite/postgres, Govor.Server.slnx, global.json), and small infra changes (AutoMapper bump, NullPushProvider, storage/token handling).
This commit is contained in:
@@ -37,7 +37,8 @@ public class MessageEditingService : IMessageEditingService
|
||||
null);
|
||||
}
|
||||
|
||||
if (message.SenderId != editParams.EditorId)
|
||||
if (message.SenderId != editParams.EditorId || !await _dbContext.HasChatAccessAsync(
|
||||
editParams.EditorId, message.RecipientId, message.RecipientType))
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"User {EditorId} unauthorized to edit message {MessageId}",
|
||||
@@ -52,7 +53,7 @@ public class MessageEditingService : IMessageEditingService
|
||||
}
|
||||
|
||||
// Проверяем время, прошедшее с момента отправки
|
||||
var now = DateTime.UtcNow;
|
||||
var now = editParams.EditedAt;
|
||||
var editDeadline = message.SentAt.AddMinutes(
|
||||
_options.MaxEditTimeMinutes);
|
||||
|
||||
@@ -83,6 +84,10 @@ public class MessageEditingService : IMessageEditingService
|
||||
MediaAttachments = message.MediaAttachments?.ToList() ?? []
|
||||
};
|
||||
|
||||
if (editParams.NewContent is null || editParams.NewContent.Length > 50_000 ||
|
||||
(string.IsNullOrWhiteSpace(editParams.NewContent) && message.MediaAttachments.Count == 0))
|
||||
return new EditMessageResult(false, new ArgumentException("Invalid message content."), null);
|
||||
|
||||
message.EncryptedContent = editParams.NewContent;
|
||||
message.IsEdited = true;
|
||||
message.EditedAt = editParams.EditedAt;
|
||||
@@ -98,4 +103,4 @@ public class MessageEditingService : IMessageEditingService
|
||||
null,
|
||||
originalMessageSnapshot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user